diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bd1b7b3..3b28767 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -3,46 +3,36 @@ lib/tremendous/api/tremendous_api.rb lib/tremendous/api_client.rb lib/tremendous/api_error.rb lib/tremendous/configuration.rb -lib/tremendous/models/allow_email.rb -lib/tremendous/models/allow_email1.rb -lib/tremendous/models/allow_ip.rb -lib/tremendous/models/allow_ip1.rb lib/tremendous/models/balance_transaction.rb lib/tremendous/models/base_order_for_create.rb +lib/tremendous/models/base_order_for_create_payment.rb lib/tremendous/models/campaign.rb lib/tremendous/models/campaign_base.rb +lib/tremendous/models/campaign_base_email_style.rb +lib/tremendous/models/campaign_base_webpage_style.rb lib/tremendous/models/channel.rb lib/tremendous/models/create_api_key200_response.rb lib/tremendous/models/create_campaign201_response.rb -lib/tremendous/models/create_campaign_request.rb lib/tremendous/models/create_invoice200_response.rb lib/tremendous/models/create_invoice_request.rb lib/tremendous/models/create_member.rb lib/tremendous/models/create_member200_response.rb -lib/tremendous/models/create_member_request.rb -lib/tremendous/models/create_order200_response.rb -lib/tremendous/models/create_order200_response_order.rb -lib/tremendous/models/create_order200_response_order_rewards_inner.rb -lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb -lib/tremendous/models/create_order201_response.rb lib/tremendous/models/create_order_request.rb lib/tremendous/models/create_organization.rb lib/tremendous/models/create_organization200_response.rb lib/tremendous/models/create_organization200_response_organization.rb +lib/tremendous/models/create_organization_copy_settings.rb lib/tremendous/models/create_organization_for_response.rb lib/tremendous/models/create_organization_properties.rb -lib/tremendous/models/create_organization_request.rb -lib/tremendous/models/create_organization_request_copy_settings.rb lib/tremendous/models/create_webhook200_response.rb -lib/tremendous/models/create_webhook_request.rb lib/tremendous/models/currency_codes.rb lib/tremendous/models/custom_field.rb -lib/tremendous/models/delete_fraud_rule200_response.rb lib/tremendous/models/delivery_details.rb lib/tremendous/models/delivery_details_with_link.rb lib/tremendous/models/delivery_method.rb lib/tremendous/models/delivery_status.rb lib/tremendous/models/error_model.rb +lib/tremendous/models/error_model_errors.rb lib/tremendous/models/field.rb lib/tremendous/models/fraud_config_allow_email.rb lib/tremendous/models/fraud_config_country.rb @@ -59,129 +49,72 @@ lib/tremendous/models/fraud_review_reason.rb lib/tremendous/models/fraud_review_redemption_method.rb lib/tremendous/models/fraud_review_related_rewards.rb lib/tremendous/models/fraud_review_status.rb -lib/tremendous/models/fraud_rule200_response.rb -lib/tremendous/models/fraud_rule400_response.rb -lib/tremendous/models/fraud_rule422_response.rb lib/tremendous/models/fraud_rule_request.rb lib/tremendous/models/fraud_rule_request_config.rb lib/tremendous/models/fraud_rule_type.rb lib/tremendous/models/fraud_rules_list_item.rb lib/tremendous/models/funding_source.rb +lib/tremendous/models/funding_source_meta.rb +lib/tremendous/models/funding_source_meta_failure_details.rb lib/tremendous/models/generate_reward_link200_response.rb -lib/tremendous/models/generate_reward_link200_response_reward.rb -lib/tremendous/models/generate_reward_link403_response.rb lib/tremendous/models/generate_reward_token200_response.rb -lib/tremendous/models/generate_reward_token200_response_reward.rb lib/tremendous/models/get_fraud_review200_response.rb -lib/tremendous/models/get_fraud_review200_response_fraud_review.rb -lib/tremendous/models/get_fraud_review200_response_fraud_review_geo.rb -lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb lib/tremendous/models/get_funding_source200_response.rb lib/tremendous/models/get_member200_response.rb -lib/tremendous/models/get_member200_response_member.rb -lib/tremendous/models/get_member200_response_member_events_inner.rb lib/tremendous/models/get_organization200_response.rb lib/tremendous/models/get_product_response.rb lib/tremendous/models/get_reward200_response.rb lib/tremendous/models/invoice.rb lib/tremendous/models/list_balance_transactions200_response.rb -lib/tremendous/models/list_balance_transactions200_response_transactions_inner.rb lib/tremendous/models/list_campaigns200_response.rb -lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb -lib/tremendous/models/list_campaigns200_response_campaigns_inner_email_style.rb -lib/tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style.rb lib/tremendous/models/list_fields200_response.rb -lib/tremendous/models/list_fields200_response_fields_inner.rb lib/tremendous/models/list_forex_response.rb lib/tremendous/models/list_fraud_reviews200_response.rb -lib/tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner.rb lib/tremendous/models/list_fraud_rules200_response.rb -lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb lib/tremendous/models/list_funding_sources200_response.rb -lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb -lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb lib/tremendous/models/list_invoices200_response.rb -lib/tremendous/models/list_invoices200_response_invoices_inner.rb lib/tremendous/models/list_members200_response.rb -lib/tremendous/models/list_members200_response_members_inner.rb lib/tremendous/models/list_orders200_response.rb -lib/tremendous/models/list_orders200_response_orders_inner.rb -lib/tremendous/models/list_orders200_response_orders_inner_payment.rb -lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb lib/tremendous/models/list_organizations200_response.rb -lib/tremendous/models/list_organizations200_response_organizations_inner.rb lib/tremendous/models/list_products_response.rb -lib/tremendous/models/list_products_response_products_inner.rb -lib/tremendous/models/list_products_response_products_inner_countries_inner.rb -lib/tremendous/models/list_products_response_products_inner_images_inner.rb -lib/tremendous/models/list_products_response_products_inner_skus_inner.rb lib/tremendous/models/list_rewards200_response.rb -lib/tremendous/models/list_rewards200_response_rewards_inner.rb -lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb -lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb -lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb -lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb -lib/tremendous/models/list_rewards401_response.rb -lib/tremendous/models/list_rewards401_response_errors.rb -lib/tremendous/models/list_rewards429_response.rb lib/tremendous/models/list_roles200_response.rb -lib/tremendous/models/list_roles200_response_roles_inner.rb lib/tremendous/models/list_webhook_events200_response.rb lib/tremendous/models/list_webhooks200_response.rb -lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb -lib/tremendous/models/member.rb lib/tremendous/models/member_base.rb lib/tremendous/models/member_with_events.rb +lib/tremendous/models/member_with_events_all_of_events.rb lib/tremendous/models/member_without_events.rb -lib/tremendous/models/order.rb lib/tremendous/models/order_base.rb lib/tremendous/models/order_base_payment.rb lib/tremendous/models/order_status.rb lib/tremendous/models/order_with_link.rb -lib/tremendous/models/order_with_link_rewards_inner.rb lib/tremendous/models/order_without_link.rb -lib/tremendous/models/order_without_link_rewards_inner.rb lib/tremendous/models/organization.rb lib/tremendous/models/payment_details.rb lib/tremendous/models/payment_details_refund.rb lib/tremendous/models/payout.rb lib/tremendous/models/product.rb +lib/tremendous/models/product_countries_inner.rb +lib/tremendous/models/product_images_inner.rb +lib/tremendous/models/product_skus_inner.rb lib/tremendous/models/recipient.rb lib/tremendous/models/refund_details.rb -lib/tremendous/models/resend_reward422_response.rb -lib/tremendous/models/review_country.rb -lib/tremendous/models/review_country1.rb -lib/tremendous/models/review_email.rb -lib/tremendous/models/review_email1.rb -lib/tremendous/models/review_ip.rb -lib/tremendous/models/review_ip1.rb -lib/tremendous/models/review_redeemed_rewards_amount.rb -lib/tremendous/models/review_redeemed_rewards_count.rb -lib/tremendous/models/reward.rb +lib/tremendous/models/resend_reward_request.rb lib/tremendous/models/reward_base.rb -lib/tremendous/models/reward_base_custom_fields_inner.rb lib/tremendous/models/reward_for_order_create.rb +lib/tremendous/models/reward_for_order_create_all_of_delivery.rb lib/tremendous/models/reward_link.rb lib/tremendous/models/reward_token.rb lib/tremendous/models/reward_value.rb lib/tremendous/models/reward_with_link.rb -lib/tremendous/models/reward_with_link_delivery.rb lib/tremendous/models/reward_without_link.rb -lib/tremendous/models/reward_without_link_delivery.rb lib/tremendous/models/role.rb lib/tremendous/models/simulate_webhook_request.rb lib/tremendous/models/single_reward_order.rb -lib/tremendous/models/single_reward_order_payment.rb -lib/tremendous/models/single_reward_order_reward.rb -lib/tremendous/models/single_reward_order_reward_custom_fields_inner.rb -lib/tremendous/models/single_reward_order_reward_delivery.rb lib/tremendous/models/single_reward_order_with_link.rb -lib/tremendous/models/single_reward_order_with_link_order.rb lib/tremendous/models/single_reward_order_without_link.rb -lib/tremendous/models/single_reward_order_without_link_order.rb lib/tremendous/models/update_campaign.rb -lib/tremendous/models/update_campaign_request.rb -lib/tremendous/models/update_fraud_rule_list200_response.rb lib/tremendous/models/update_fraud_rule_list_request.rb lib/tremendous/models/update_fraud_rule_list_request_config.rb lib/tremendous/models/webhook.rb diff --git a/lib/tremendous.rb b/lib/tremendous.rb index 27caa93..4fecb65 100644 --- a/lib/tremendous.rb +++ b/lib/tremendous.rb @@ -17,46 +17,36 @@ require 'tremendous/configuration' # Models -require 'tremendous/models/allow_email' -require 'tremendous/models/allow_email1' -require 'tremendous/models/allow_ip' -require 'tremendous/models/allow_ip1' require 'tremendous/models/balance_transaction' require 'tremendous/models/base_order_for_create' +require 'tremendous/models/base_order_for_create_payment' require 'tremendous/models/campaign' require 'tremendous/models/campaign_base' +require 'tremendous/models/campaign_base_email_style' +require 'tremendous/models/campaign_base_webpage_style' require 'tremendous/models/channel' require 'tremendous/models/create_api_key200_response' require 'tremendous/models/create_campaign201_response' -require 'tremendous/models/create_campaign_request' require 'tremendous/models/create_invoice200_response' require 'tremendous/models/create_invoice_request' require 'tremendous/models/create_member' require 'tremendous/models/create_member200_response' -require 'tremendous/models/create_member_request' -require 'tremendous/models/create_order200_response' -require 'tremendous/models/create_order200_response_order' -require 'tremendous/models/create_order200_response_order_rewards_inner' -require 'tremendous/models/create_order200_response_order_rewards_inner_delivery' -require 'tremendous/models/create_order201_response' require 'tremendous/models/create_order_request' require 'tremendous/models/create_organization' require 'tremendous/models/create_organization200_response' require 'tremendous/models/create_organization200_response_organization' +require 'tremendous/models/create_organization_copy_settings' require 'tremendous/models/create_organization_for_response' require 'tremendous/models/create_organization_properties' -require 'tremendous/models/create_organization_request' -require 'tremendous/models/create_organization_request_copy_settings' require 'tremendous/models/create_webhook200_response' -require 'tremendous/models/create_webhook_request' require 'tremendous/models/currency_codes' require 'tremendous/models/custom_field' -require 'tremendous/models/delete_fraud_rule200_response' require 'tremendous/models/delivery_details' require 'tremendous/models/delivery_details_with_link' require 'tremendous/models/delivery_method' require 'tremendous/models/delivery_status' require 'tremendous/models/error_model' +require 'tremendous/models/error_model_errors' require 'tremendous/models/field' require 'tremendous/models/fraud_config_allow_email' require 'tremendous/models/fraud_config_country' @@ -73,129 +63,72 @@ require 'tremendous/models/fraud_review_redemption_method' require 'tremendous/models/fraud_review_related_rewards' require 'tremendous/models/fraud_review_status' -require 'tremendous/models/fraud_rule200_response' -require 'tremendous/models/fraud_rule400_response' -require 'tremendous/models/fraud_rule422_response' require 'tremendous/models/fraud_rule_request' require 'tremendous/models/fraud_rule_request_config' require 'tremendous/models/fraud_rule_type' require 'tremendous/models/fraud_rules_list_item' require 'tremendous/models/funding_source' +require 'tremendous/models/funding_source_meta' +require 'tremendous/models/funding_source_meta_failure_details' require 'tremendous/models/generate_reward_link200_response' -require 'tremendous/models/generate_reward_link200_response_reward' -require 'tremendous/models/generate_reward_link403_response' require 'tremendous/models/generate_reward_token200_response' -require 'tremendous/models/generate_reward_token200_response_reward' require 'tremendous/models/get_fraud_review200_response' -require 'tremendous/models/get_fraud_review200_response_fraud_review' -require 'tremendous/models/get_fraud_review200_response_fraud_review_geo' -require 'tremendous/models/get_fraud_review200_response_fraud_review_related_rewards' require 'tremendous/models/get_funding_source200_response' require 'tremendous/models/get_member200_response' -require 'tremendous/models/get_member200_response_member' -require 'tremendous/models/get_member200_response_member_events_inner' require 'tremendous/models/get_organization200_response' require 'tremendous/models/get_product_response' require 'tremendous/models/get_reward200_response' require 'tremendous/models/invoice' require 'tremendous/models/list_balance_transactions200_response' -require 'tremendous/models/list_balance_transactions200_response_transactions_inner' require 'tremendous/models/list_campaigns200_response' -require 'tremendous/models/list_campaigns200_response_campaigns_inner' -require 'tremendous/models/list_campaigns200_response_campaigns_inner_email_style' -require 'tremendous/models/list_campaigns200_response_campaigns_inner_webpage_style' require 'tremendous/models/list_fields200_response' -require 'tremendous/models/list_fields200_response_fields_inner' require 'tremendous/models/list_forex_response' require 'tremendous/models/list_fraud_reviews200_response' -require 'tremendous/models/list_fraud_reviews200_response_fraud_reviews_inner' require 'tremendous/models/list_fraud_rules200_response' -require 'tremendous/models/list_fraud_rules200_response_fraud_rules_inner' require 'tremendous/models/list_funding_sources200_response' -require 'tremendous/models/list_funding_sources200_response_funding_sources_inner' -require 'tremendous/models/list_funding_sources200_response_funding_sources_inner_meta' require 'tremendous/models/list_invoices200_response' -require 'tremendous/models/list_invoices200_response_invoices_inner' require 'tremendous/models/list_members200_response' -require 'tremendous/models/list_members200_response_members_inner' require 'tremendous/models/list_orders200_response' -require 'tremendous/models/list_orders200_response_orders_inner' -require 'tremendous/models/list_orders200_response_orders_inner_payment' -require 'tremendous/models/list_orders200_response_orders_inner_payment_refund' require 'tremendous/models/list_organizations200_response' -require 'tremendous/models/list_organizations200_response_organizations_inner' require 'tremendous/models/list_products_response' -require 'tremendous/models/list_products_response_products_inner' -require 'tremendous/models/list_products_response_products_inner_countries_inner' -require 'tremendous/models/list_products_response_products_inner_images_inner' -require 'tremendous/models/list_products_response_products_inner_skus_inner' require 'tremendous/models/list_rewards200_response' -require 'tremendous/models/list_rewards200_response_rewards_inner' -require 'tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner' -require 'tremendous/models/list_rewards200_response_rewards_inner_delivery' -require 'tremendous/models/list_rewards200_response_rewards_inner_recipient' -require 'tremendous/models/list_rewards200_response_rewards_inner_value' -require 'tremendous/models/list_rewards401_response' -require 'tremendous/models/list_rewards401_response_errors' -require 'tremendous/models/list_rewards429_response' require 'tremendous/models/list_roles200_response' -require 'tremendous/models/list_roles200_response_roles_inner' require 'tremendous/models/list_webhook_events200_response' require 'tremendous/models/list_webhooks200_response' -require 'tremendous/models/list_webhooks200_response_webhooks_inner' -require 'tremendous/models/member' require 'tremendous/models/member_base' require 'tremendous/models/member_with_events' +require 'tremendous/models/member_with_events_all_of_events' require 'tremendous/models/member_without_events' -require 'tremendous/models/order' require 'tremendous/models/order_base' require 'tremendous/models/order_base_payment' require 'tremendous/models/order_status' require 'tremendous/models/order_with_link' -require 'tremendous/models/order_with_link_rewards_inner' require 'tremendous/models/order_without_link' -require 'tremendous/models/order_without_link_rewards_inner' require 'tremendous/models/organization' require 'tremendous/models/payment_details' require 'tremendous/models/payment_details_refund' require 'tremendous/models/payout' require 'tremendous/models/product' +require 'tremendous/models/product_countries_inner' +require 'tremendous/models/product_images_inner' +require 'tremendous/models/product_skus_inner' require 'tremendous/models/recipient' require 'tremendous/models/refund_details' -require 'tremendous/models/resend_reward422_response' -require 'tremendous/models/review_country' -require 'tremendous/models/review_country1' -require 'tremendous/models/review_email' -require 'tremendous/models/review_email1' -require 'tremendous/models/review_ip' -require 'tremendous/models/review_ip1' -require 'tremendous/models/review_redeemed_rewards_amount' -require 'tremendous/models/review_redeemed_rewards_count' -require 'tremendous/models/reward' +require 'tremendous/models/resend_reward_request' require 'tremendous/models/reward_base' -require 'tremendous/models/reward_base_custom_fields_inner' require 'tremendous/models/reward_for_order_create' +require 'tremendous/models/reward_for_order_create_all_of_delivery' require 'tremendous/models/reward_link' require 'tremendous/models/reward_token' require 'tremendous/models/reward_value' require 'tremendous/models/reward_with_link' -require 'tremendous/models/reward_with_link_delivery' require 'tremendous/models/reward_without_link' -require 'tremendous/models/reward_without_link_delivery' require 'tremendous/models/role' require 'tremendous/models/simulate_webhook_request' require 'tremendous/models/single_reward_order' -require 'tremendous/models/single_reward_order_payment' -require 'tremendous/models/single_reward_order_reward' -require 'tremendous/models/single_reward_order_reward_custom_fields_inner' -require 'tremendous/models/single_reward_order_reward_delivery' require 'tremendous/models/single_reward_order_with_link' -require 'tremendous/models/single_reward_order_with_link_order' require 'tremendous/models/single_reward_order_without_link' -require 'tremendous/models/single_reward_order_without_link_order' require 'tremendous/models/update_campaign' -require 'tremendous/models/update_campaign_request' -require 'tremendous/models/update_fraud_rule_list200_response' require 'tremendous/models/update_fraud_rule_list_request' require 'tremendous/models/update_fraud_rule_list_request_config' require 'tremendous/models/webhook' diff --git a/lib/tremendous/api/tremendous_api.rb b/lib/tremendous/api/tremendous_api.rb index fa380b0..14442dd 100644 --- a/lib/tremendous/api/tremendous_api.rb +++ b/lib/tremendous/api/tremendous_api.rb @@ -23,7 +23,7 @@ def initialize(api_client = ApiClient.default) # Approves an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard. # @param id [String] ID of the order that should be approved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [CreateOrder201Response] + # @return [SingleRewardOrderWithoutLink] def approve_order(id, opts = {}) data, _status_code, _headers = approve_order_with_http_info(id, opts) data @@ -33,7 +33,7 @@ def approve_order(id, opts = {}) # Approves an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard. # @param id [String] ID of the order that should be approved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers + # @return [Array<(SingleRewardOrderWithoutLink, Integer, Hash)>] SingleRewardOrderWithoutLink data, response status code and response headers def approve_order_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.approve_order ...' @@ -65,7 +65,7 @@ def approve_order_with_http_info(id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'CreateOrder201Response' + return_type = opts[:debug_return_type] || 'SingleRewardOrderWithoutLink' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -208,25 +208,25 @@ def create_api_key_with_http_info(opts = {}) end # Create campaign - # @param create_campaign_request [CreateCampaignRequest] Campaign details + # @param campaign [Campaign] Campaign details # @param [Hash] opts the optional parameters # @return [CreateCampaign201Response] - def create_campaign(create_campaign_request, opts = {}) - data, _status_code, _headers = create_campaign_with_http_info(create_campaign_request, opts) + def create_campaign(campaign, opts = {}) + data, _status_code, _headers = create_campaign_with_http_info(campaign, opts) data end # Create campaign - # @param create_campaign_request [CreateCampaignRequest] Campaign details + # @param campaign [Campaign] Campaign details # @param [Hash] opts the optional parameters # @return [Array<(CreateCampaign201Response, Integer, Hash)>] CreateCampaign201Response data, response status code and response headers - def create_campaign_with_http_info(create_campaign_request, opts = {}) + def create_campaign_with_http_info(campaign, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.create_campaign ...' end - # verify the required parameter 'create_campaign_request' is set - if @api_client.config.client_side_validation && create_campaign_request.nil? - fail ArgumentError, "Missing the required parameter 'create_campaign_request' when calling TremendousApi.create_campaign" + # verify the required parameter 'campaign' is set + if @api_client.config.client_side_validation && campaign.nil? + fail ArgumentError, "Missing the required parameter 'campaign' when calling TremendousApi.create_campaign" end # resource path local_var_path = '/campaigns' @@ -248,7 +248,7 @@ def create_campaign_with_http_info(create_campaign_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(create_campaign_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(campaign) # return_type return_type = opts[:debug_return_type] || 'CreateCampaign201Response' @@ -274,7 +274,7 @@ def create_campaign_with_http_info(create_campaign_request, opts = {}) end # Create invoice - # Creating an invoice is the way for your organization to fund your account's balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account's balance ## Request body
Property Type Description
po_number
string

Reference to the purchase order number within your organization

amount
number double

Amount of the invoice in USD

memo
string

A note to be included in the invoice. This is for your internal use and will not be visible to the recipient.

+ # Creating an invoice is the way for your organization to fund your account's balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account's balance # @param create_invoice_request [CreateInvoiceRequest] Invoice details # @param [Hash] opts the optional parameters # @return [CreateInvoice200Response] @@ -284,7 +284,7 @@ def create_invoice(create_invoice_request, opts = {}) end # Create invoice - # Creating an invoice is the way for your organization to fund your account's balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account's balance ## Request body <div class=\"object-schema-request-schema\"> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">po_number</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Reference to the purchase order number within your organization</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">amount</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the invoice in USD</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">memo</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>A note to be included in the invoice. This is for your internal use and will not be visible to the recipient.</p> </td></tr> </tbody> </table> </div> + # Creating an invoice is the way for your organization to fund your account's balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account's balance # @param create_invoice_request [CreateInvoiceRequest] Invoice details # @param [Hash] opts the optional parameters # @return [Array<(CreateInvoice200Response, Integer, Hash)>] CreateInvoice200Response data, response status code and response headers @@ -343,26 +343,26 @@ def create_invoice_with_http_info(create_invoice_request, opts = {}) # Create member # Each organization has one or more users that can access and manage that organization. These users are called members. Members can take actions via the Tremendous web dashboard directly. These actions include adding funding sources to the organization, creating Campaigns, and more. ### Permissions Members can have a role that determine their permissions within the organization. Check the Roles API for the available roles. To create members of a sub-organizations [create an API key for that organization](/reference/post_organizations-id-create-api-key) first, then use the new API key in the create member request. ### Inviting new members After creating a member, an automatic invite is sent to the email address. If the user is not registered yet, that person will then need to sign up for a Tremendous account. > ❗️ Automatic invitations are not available in the sandbox > > You must manually use the returned `invite_url` field in the payload instead. - # @param create_member_request [CreateMemberRequest] Member details + # @param create_member [CreateMember] Member details # @param [Hash] opts the optional parameters # @return [CreateMember200Response] - def create_member(create_member_request, opts = {}) - data, _status_code, _headers = create_member_with_http_info(create_member_request, opts) + def create_member(create_member, opts = {}) + data, _status_code, _headers = create_member_with_http_info(create_member, opts) data end # Create member # Each organization has one or more users that can access and manage that organization. These users are called members. Members can take actions via the Tremendous web dashboard directly. These actions include adding funding sources to the organization, creating Campaigns, and more. ### Permissions Members can have a role that determine their permissions within the organization. Check the Roles API for the available roles. To create members of a sub-organizations [create an API key for that organization](/reference/post_organizations-id-create-api-key) first, then use the new API key in the create member request. ### Inviting new members After creating a member, an automatic invite is sent to the email address. If the user is not registered yet, that person will then need to sign up for a Tremendous account. > ❗️ Automatic invitations are not available in the sandbox > > You must manually use the returned `invite_url` field in the payload instead. - # @param create_member_request [CreateMemberRequest] Member details + # @param create_member [CreateMember] Member details # @param [Hash] opts the optional parameters # @return [Array<(CreateMember200Response, Integer, Hash)>] CreateMember200Response data, response status code and response headers - def create_member_with_http_info(create_member_request, opts = {}) + def create_member_with_http_info(create_member, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.create_member ...' end - # verify the required parameter 'create_member_request' is set - if @api_client.config.client_side_validation && create_member_request.nil? - fail ArgumentError, "Missing the required parameter 'create_member_request' when calling TremendousApi.create_member" + # verify the required parameter 'create_member' is set + if @api_client.config.client_side_validation && create_member.nil? + fail ArgumentError, "Missing the required parameter 'create_member' when calling TremendousApi.create_member" end # resource path local_var_path = '/members' @@ -384,7 +384,7 @@ def create_member_with_http_info(create_member_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(create_member_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_member) # return_type return_type = opts[:debug_return_type] || 'CreateMember200Response' @@ -410,20 +410,20 @@ def create_member_with_http_info(create_member_request, opts = {}) end # Create order - # Every time you want to send out a reward through Tremendous you need to create an order for it. > 📘 Getting started with your first order > > Our step-by-step guide walks you through everything you need > to send your first gift card through the Tremendous API: > > Check it out! ## Request body
Property Type Description
external_id
string

Reference for this order, supplied by the customer.

When set, external_id makes order idempotent. All requests that use the same external_id after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a 201 response code. These responses fail to create any further orders.

It also allows for retrieving by external_id instead of id only.

payment
object
Show object properties
Property Type Description
funding_source_id
string

Tremendous ID of the funding source that will be used to pay for the order. Use balance to use your Tremendous's balance.

reward
object

A single reward, sent to a recipient. A reward is always part of an order.

Either products or campaign_id must be specified.

Show object properties
Property Type Description
id
string

Tremendous ID of the reward

order_id
string

Tremendous ID of the order this reward is part of.

created_at
string date-time

Date the reward was created

campaign_id
string

ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.

products
array string

List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.

Providing a products array will override the products made available by the campaign specified using the campaign_id property unless the products array is empty. It will not override other campaign attributes, like the message and customization of the look and feel.

value
object
Show object properties
Property Type Description
denomination
number double

Amount of the reward

currency_code
string

Currency of the reward

recipient
object

Details of the recipient of the reward

Show object properties
Property Type Description
name
string

Name of the recipient

email
string

Email address of the recipient

phone
string

Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).

deliver_at
string date

Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.

custom_fields
array
Show array item type
Property Type Description
id
string

Tremendous ID of the custom field

value
string

Value of the custom field

label
string

Label of the custom field

language
string

Set this to translate the redemption experience for this reward. Pass a 2-letter ISO-639-1 code for the desired language. Defaults to en.

delivery
object

Details on how the reward is delivered to the recipient.

Show object properties
Property Type Description
method
string

How to deliver the reward to the recipient.

Delivery Method Description
EMAIL Deliver the reward to the recipient by email
LINK

Deliver the reward to the recipient via a link.

The link can be retrieved on a successfully ordered reward via the /rewards or /rewards/{id} endpoint. That link must then be delivered to the recipient out-of-band.

PHONE Deliver the reward to the recipient by SMS
### Funding sources There are different ways to pay for gift cards and rewards on Tremendous. Every payment mechanism is called a \"funding source\". You can retrieve a list of all available funding sources by using the [Funding sources API endpoint](https://tremendous.readme.io/reference/core-funding-source-index). The Tremendous API sandbox environment comes with a single funding source that allows you to spend up to $5,000 in *fake money* to test the API. [Learn more about the sandbox environment](https://tremendous.readme.io/reference/sandbox). The HTTP status code `200` on the response will be used to indicate success. After processing successfully the reward gets queued to be delivered to it's recipient (for delivery method `EMAIL` and `PHONE`). Delivery will happen asynchronously, after the response has been sent. ### Idempotence Requests issued with the same external_id are idempotent. Submitting an order with an already existing `external_id`, will result in a `201` response code. In this case the response will return a representation of the already existing order in the response body. + # Every time you want to send out a reward through Tremendous you need to create an order for it. > 📘 Getting started with your first order > > Our step-by-step guide walks you through everything you need > to send your first gift card through the Tremendous API: > > Check it out! ### Funding sources There are different ways to pay for gift cards and rewards on Tremendous. Every payment mechanism is called a \"funding source\". You can retrieve a list of all available funding sources by using the [Funding sources API endpoint](https://tremendous.readme.io/reference/core-funding-source-index). The Tremendous API sandbox environment comes with a single funding source that allows you to spend up to $5,000 in *fake money* to test the API. [Learn more about the sandbox environment](https://tremendous.readme.io/reference/sandbox). The HTTP status code `200` on the response will be used to indicate success. After processing successfully the reward gets queued to be delivered to it's recipient (for delivery method `EMAIL` and `PHONE`). Delivery will happen asynchronously, after the response has been sent. ### Idempotence Requests issued with the same external_id are idempotent. Submitting an order with an already existing `external_id`, will result in a `201` response code. In this case the response will return a representation of the already existing order in the response body. # @param create_order_request [CreateOrderRequest] Order to create # @param [Hash] opts the optional parameters - # @return [CreateOrder200Response] + # @return [SingleRewardOrderWithLink] def create_order(create_order_request, opts = {}) data, _status_code, _headers = create_order_with_http_info(create_order_request, opts) data end # Create order - # Every time you want to send out a reward through Tremendous you need to create an order for it. > 📘 Getting started with your first order > > Our step-by-step guide walks you through everything you need > to send your first gift card through the Tremendous API: > > <strong><a style=\"display: block; margin-top: 20px;\" href=\"/docs/sending-rewards-intro\">Check it out!</a></strong> ## Request body <div class=\"object-schema-request-schema\"> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">external_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Reference for this order, supplied by the customer.</p> <p>When set, <code>external_id</code> makes order idempotent. All requests that use the same <code>external_id</code> after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a <code>201</code> response code. These responses <strong>fail</strong> to create any further orders.</p> <p>It also allows for retrieving by <code>external_id</code> instead of <code>id</code> only.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">payment</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">funding_source_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the funding source that will be used to pay for the order. Use <code>balance</code> to use your Tremendous&#39;s balance.</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">reward</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>A single reward, sent to a recipient. A reward is always part of an order.</p> <p>Either <code>products</code> or <code>campaign_id</code> must be specified.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the reward</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">order_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the order this reward is part of.</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">created_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date-time</span></td><td><p>Date the reward was created</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">campaign_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">products</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.</p> <p>Providing a <code>products</code> array will override the products made available by the campaign specified using the <code>campaign_id</code> property unless the <code>products</code> array is empty. It will <em>not</em> override other campaign attributes, like the message and customization of the look and feel.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">denomination</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the reward</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency_code</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the reward</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">recipient</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details of the recipient of the reward</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Name of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">email</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Email address of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">phone</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">deliver_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">custom_fields</code> </div> </td><td><span class=\"property-type\">array</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show array item type</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the custom field</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Value of the custom field</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">label</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Label of the custom field</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">language</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Set this to translate the redemption experience for this reward. Pass a 2-letter <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">ISO-639-1 code</a> for the desired language. Defaults to <code>en</code>.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details on how the reward is delivered to the recipient.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>How to deliver the reward to the recipient.</p> <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table> </td></tr> </tbody> </table> </tr> </tbody> </table> </tr> </tbody> </table> </div> ### Funding sources There are different ways to pay for gift cards and rewards on Tremendous. Every payment mechanism is called a \"funding source\". You can retrieve a list of all available funding sources by using the [Funding sources API endpoint](https://tremendous.readme.io/reference/core-funding-source-index). The Tremendous API sandbox environment comes with a single funding source that allows you to spend up to $5,000 in *fake money* to test the API. [Learn more about the sandbox environment](https://tremendous.readme.io/reference/sandbox). The HTTP status code `200` on the response will be used to indicate success. After processing successfully the reward gets queued to be delivered to it's recipient (for delivery method `EMAIL` and `PHONE`). Delivery will happen asynchronously, after the response has been sent. ### Idempotence Requests issued with the same external_id are idempotent. Submitting an order with an already existing `external_id`, will result in a `201` response code. In this case the response will return a representation of the already existing order in the response body. + # Every time you want to send out a reward through Tremendous you need to create an order for it. > 📘 Getting started with your first order > > Our step-by-step guide walks you through everything you need > to send your first gift card through the Tremendous API: > > <strong><a style=\"display: block; margin-top: 20px;\" href=\"/docs/sending-rewards-intro\">Check it out!</a></strong> ### Funding sources There are different ways to pay for gift cards and rewards on Tremendous. Every payment mechanism is called a \"funding source\". You can retrieve a list of all available funding sources by using the [Funding sources API endpoint](https://tremendous.readme.io/reference/core-funding-source-index). The Tremendous API sandbox environment comes with a single funding source that allows you to spend up to $5,000 in *fake money* to test the API. [Learn more about the sandbox environment](https://tremendous.readme.io/reference/sandbox). The HTTP status code `200` on the response will be used to indicate success. After processing successfully the reward gets queued to be delivered to it's recipient (for delivery method `EMAIL` and `PHONE`). Delivery will happen asynchronously, after the response has been sent. ### Idempotence Requests issued with the same external_id are idempotent. Submitting an order with an already existing `external_id`, will result in a `201` response code. In this case the response will return a representation of the already existing order in the response body. # @param create_order_request [CreateOrderRequest] Order to create # @param [Hash] opts the optional parameters - # @return [Array<(CreateOrder200Response, Integer, Hash)>] CreateOrder200Response data, response status code and response headers + # @return [Array<(SingleRewardOrderWithLink, Integer, Hash)>] SingleRewardOrderWithLink data, response status code and response headers def create_order_with_http_info(create_order_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.create_order ...' @@ -455,7 +455,7 @@ def create_order_with_http_info(create_order_request, opts = {}) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_order_request) # return_type - return_type = opts[:debug_return_type] || 'CreateOrder200Response' + return_type = opts[:debug_return_type] || 'SingleRewardOrderWithLink' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -479,26 +479,26 @@ def create_order_with_http_info(create_order_request, opts = {}) # Create organization # Organizations are a way to separate different parts of your business within the same Tremendous account. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. API keys belong to a single organization. The API key used in a request determines on behalf of which organization the request is carried out. **Important note:** When creating an organization, you are required to either pass `with_api_key` or `copy_settings[user]` in the request body as `true`. This ensures that your new Organization can either be accessed via the API or the Dashboard. - # @param create_organization_request [CreateOrganizationRequest] Organization details + # @param create_organization [CreateOrganization] Organization details # @param [Hash] opts the optional parameters # @return [CreateOrganization200Response] - def create_organization(create_organization_request, opts = {}) - data, _status_code, _headers = create_organization_with_http_info(create_organization_request, opts) + def create_organization(create_organization, opts = {}) + data, _status_code, _headers = create_organization_with_http_info(create_organization, opts) data end # Create organization # Organizations are a way to separate different parts of your business within the same Tremendous account. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. API keys belong to a single organization. The API key used in a request determines on behalf of which organization the request is carried out. **Important note:** When creating an organization, you are required to either pass `with_api_key` or `copy_settings[user]` in the request body as `true`. This ensures that your new Organization can either be accessed via the API or the Dashboard. - # @param create_organization_request [CreateOrganizationRequest] Organization details + # @param create_organization [CreateOrganization] Organization details # @param [Hash] opts the optional parameters # @return [Array<(CreateOrganization200Response, Integer, Hash)>] CreateOrganization200Response data, response status code and response headers - def create_organization_with_http_info(create_organization_request, opts = {}) + def create_organization_with_http_info(create_organization, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.create_organization ...' end - # verify the required parameter 'create_organization_request' is set - if @api_client.config.client_side_validation && create_organization_request.nil? - fail ArgumentError, "Missing the required parameter 'create_organization_request' when calling TremendousApi.create_organization" + # verify the required parameter 'create_organization' is set + if @api_client.config.client_side_validation && create_organization.nil? + fail ArgumentError, "Missing the required parameter 'create_organization' when calling TremendousApi.create_organization" end # resource path local_var_path = '/organizations' @@ -520,7 +520,7 @@ def create_organization_with_http_info(create_organization_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization) # return_type return_type = opts[:debug_return_type] || 'CreateOrganization200Response' @@ -546,27 +546,27 @@ def create_organization_with_http_info(create_organization_request, opts = {}) end # Create webhook - # Tremendous uses webhooks as a notification system for various events that happen in your account. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) Every organization can define a single webhook endpoint where we send requests to, whenever an event happens. This endpoint allows you to setup that endpoint. The URL of the endpoint can be changed by making a request to this endpoint again with the new URL. ## Request body
Property Type Description
url
string uri

URL the webhook will make requests to

- # @param create_webhook_request [CreateWebhookRequest] Webhook details + # Tremendous uses webhooks as a notification system for various events that happen in your account. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) Every organization can define a single webhook endpoint where we send requests to, whenever an event happens. This endpoint allows you to setup that endpoint. The URL of the endpoint can be changed by making a request to this endpoint again with the new URL. + # @param webhook_post [WebhookPost] Webhook details # @param [Hash] opts the optional parameters # @return [CreateWebhook200Response] - def create_webhook(create_webhook_request, opts = {}) - data, _status_code, _headers = create_webhook_with_http_info(create_webhook_request, opts) + def create_webhook(webhook_post, opts = {}) + data, _status_code, _headers = create_webhook_with_http_info(webhook_post, opts) data end # Create webhook - # Tremendous uses webhooks as a notification system for various events that happen in your account. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) Every organization can define a single webhook endpoint where we send requests to, whenever an event happens. This endpoint allows you to setup that endpoint. The URL of the endpoint can be changed by making a request to this endpoint again with the new URL. ## Request body <div class=\"object-schema-request-schema\"> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">url</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">uri</span></td><td><p>URL the webhook will make requests to</p> </td></tr> </tbody> </table> </div> - # @param create_webhook_request [CreateWebhookRequest] Webhook details + # Tremendous uses webhooks as a notification system for various events that happen in your account. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) Every organization can define a single webhook endpoint where we send requests to, whenever an event happens. This endpoint allows you to setup that endpoint. The URL of the endpoint can be changed by making a request to this endpoint again with the new URL. + # @param webhook_post [WebhookPost] Webhook details # @param [Hash] opts the optional parameters # @return [Array<(CreateWebhook200Response, Integer, Hash)>] CreateWebhook200Response data, response status code and response headers - def create_webhook_with_http_info(create_webhook_request, opts = {}) + def create_webhook_with_http_info(webhook_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.create_webhook ...' end - # verify the required parameter 'create_webhook_request' is set - if @api_client.config.client_side_validation && create_webhook_request.nil? - fail ArgumentError, "Missing the required parameter 'create_webhook_request' when calling TremendousApi.create_webhook" + # verify the required parameter 'webhook_post' is set + if @api_client.config.client_side_validation && webhook_post.nil? + fail ArgumentError, "Missing the required parameter 'webhook_post' when calling TremendousApi.create_webhook" end # resource path local_var_path = '/webhooks' @@ -588,7 +588,7 @@ def create_webhook_with_http_info(create_webhook_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(create_webhook_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_post) # return_type return_type = opts[:debug_return_type] || 'CreateWebhook200Response' @@ -615,9 +615,9 @@ def create_webhook_with_http_info(create_webhook_request, opts = {}) # Delete fraud rule # Deletes the rule of the type passed in the URL. - # @param rule_type [String] The rule type to create or update. + # @param rule_type [FraudRuleType] The rule type to create or update. # @param [Hash] opts the optional parameters - # @return [DeleteFraudRule200Response] + # @return [FraudGenericResponse] def delete_fraud_rule(rule_type, opts = {}) data, _status_code, _headers = delete_fraud_rule_with_http_info(rule_type, opts) data @@ -625,9 +625,9 @@ def delete_fraud_rule(rule_type, opts = {}) # Delete fraud rule # Deletes the rule of the type passed in the URL. - # @param rule_type [String] The rule type to create or update. + # @param rule_type [FraudRuleType] The rule type to create or update. # @param [Hash] opts the optional parameters - # @return [Array<(DeleteFraudRule200Response, Integer, Hash)>] DeleteFraudRule200Response data, response status code and response headers + # @return [Array<(FraudGenericResponse, Integer, Hash)>] FraudGenericResponse data, response status code and response headers def delete_fraud_rule_with_http_info(rule_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.delete_fraud_rule ...' @@ -636,11 +636,6 @@ def delete_fraud_rule_with_http_info(rule_type, opts = {}) if @api_client.config.client_side_validation && rule_type.nil? fail ArgumentError, "Missing the required parameter 'rule_type' when calling TremendousApi.delete_fraud_rule" end - # verify enum value - allowable_values = ["review_country", "review_ip", "review_email", "review_redeemed_rewards_count", "review_redeemed_rewards_amount", "review_multiple_emails", "review_vpn", "review_tremendous_flag_list", "review_previously_blocked_recipients", "allow_ip", "allow_email"] - if @api_client.config.client_side_validation && !allowable_values.include?(rule_type) - fail ArgumentError, "invalid value for \"rule_type\", must be one of #{allowable_values}" - end # resource path local_var_path = '/fraud_rules/{rule_type}'.sub('{' + 'rule_type' + '}', CGI.escape(rule_type.to_s)) @@ -659,7 +654,7 @@ def delete_fraud_rule_with_http_info(rule_type, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'DeleteFraudRule200Response' + return_type = opts[:debug_return_type] || 'FraudGenericResponse' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -940,10 +935,10 @@ def download_invoice_pdf_with_http_info(id, opts = {}) # Configure fraud rule # Configure a fraud rule of the type passed in the URL. If a rule of the same type already exists, it will be overwritten. - # @param rule_type [String] The rule type to create or update. + # @param rule_type [FraudRuleType] The rule type to create or update. # @param [Hash] opts the optional parameters # @option opts [FraudRuleRequest] :fraud_rule_request Rules `review_multiple_emails`, `review_vpn`, `review_tremendous_flaglist`, and `review_previously_blocked_recipients` require no body. - # @return [FraudRule200Response] + # @return [FraudGenericResponse] def fraud_rule(rule_type, opts = {}) data, _status_code, _headers = fraud_rule_with_http_info(rule_type, opts) data @@ -951,10 +946,10 @@ def fraud_rule(rule_type, opts = {}) # Configure fraud rule # Configure a fraud rule of the type passed in the URL. If a rule of the same type already exists, it will be overwritten. - # @param rule_type [String] The rule type to create or update. + # @param rule_type [FraudRuleType] The rule type to create or update. # @param [Hash] opts the optional parameters # @option opts [FraudRuleRequest] :fraud_rule_request Rules `review_multiple_emails`, `review_vpn`, `review_tremendous_flaglist`, and `review_previously_blocked_recipients` require no body. - # @return [Array<(FraudRule200Response, Integer, Hash)>] FraudRule200Response data, response status code and response headers + # @return [Array<(FraudGenericResponse, Integer, Hash)>] FraudGenericResponse data, response status code and response headers def fraud_rule_with_http_info(rule_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.fraud_rule ...' @@ -963,11 +958,6 @@ def fraud_rule_with_http_info(rule_type, opts = {}) if @api_client.config.client_side_validation && rule_type.nil? fail ArgumentError, "Missing the required parameter 'rule_type' when calling TremendousApi.fraud_rule" end - # verify enum value - allowable_values = ["review_country", "review_ip", "review_email", "review_redeemed_rewards_count", "review_redeemed_rewards_amount", "review_multiple_emails", "review_vpn", "review_tremendous_flag_list", "review_previously_blocked_recipients", "allow_ip", "allow_email"] - if @api_client.config.client_side_validation && !allowable_values.include?(rule_type) - fail ArgumentError, "invalid value for \"rule_type\", must be one of #{allowable_values}" - end # resource path local_var_path = '/fraud_rules/{rule_type}'.sub('{' + 'rule_type' + '}', CGI.escape(rule_type.to_s)) @@ -991,7 +981,7 @@ def fraud_rule_with_http_info(rule_type, opts = {}) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'fraud_rule_request']) # return_type - return_type = opts[:debug_return_type] || 'FraudRule200Response' + return_type = opts[:debug_return_type] || 'FraudGenericResponse' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -1481,7 +1471,7 @@ def get_member_with_http_info(id, opts = {}) # Retrieve the order, identified by the given `id` in the URL # @param id [String] ID of the order that should be retrieved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [CreateOrder201Response] + # @return [SingleRewardOrderWithoutLink] def get_order(id, opts = {}) data, _status_code, _headers = get_order_with_http_info(id, opts) data @@ -1491,7 +1481,7 @@ def get_order(id, opts = {}) # Retrieve the order, identified by the given `id` in the URL # @param id [String] ID of the order that should be retrieved. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers + # @return [Array<(SingleRewardOrderWithoutLink, Integer, Hash)>] SingleRewardOrderWithoutLink data, response status code and response headers def get_order_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.get_order ...' @@ -1518,7 +1508,7 @@ def get_order_with_http_info(id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'CreateOrder201Response' + return_type = opts[:debug_return_type] || 'SingleRewardOrderWithoutLink' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -2822,7 +2812,7 @@ def list_webhooks_with_http_info(opts = {}) # Rejects an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard. # @param id [String] ID of the order that should be rejected. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [CreateOrder201Response] + # @return [SingleRewardOrderWithoutLink] def reject_order(id, opts = {}) data, _status_code, _headers = reject_order_with_http_info(id, opts) data @@ -2832,7 +2822,7 @@ def reject_order(id, opts = {}) # Rejects an order that is pending review, identified by the given `id` in the URL. Approvals is a feature that requires orders to be approved by an organization admin before they are sent out. To enable approvals for your organization, please enable 'Allow approvals via API' via the organization''s 'Order Approvals' settings from the Tremendous dashboard. # @param id [String] ID of the order that should be rejected. In case the order has an `external_id` reference supplied by the customer on creation, it's possible to use it instead. # @param [Hash] opts the optional parameters - # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers + # @return [Array<(SingleRewardOrderWithoutLink, Integer, Hash)>] SingleRewardOrderWithoutLink data, response status code and response headers def reject_order_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.reject_order ...' @@ -2864,7 +2854,7 @@ def reject_order_with_http_info(id, opts = {}) post_body = opts[:debug_body] # return_type - return_type = opts[:debug_return_type] || 'CreateOrder201Response' + return_type = opts[:debug_return_type] || 'SingleRewardOrderWithoutLink' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] @@ -2953,6 +2943,7 @@ def release_fraud_review_with_http_info(id, opts = {}) # Resends a reward, identified by the given `id` in the URL, to its recipient. # @param id [String] ID of the reward that should be resent # @param [Hash] opts the optional parameters + # @option opts [ResendRewardRequest] :resend_reward_request _Only_ for rewards with a previous delivery failure: You can update the email or phone number used for the resend. You can only provide one of `updated_email` or `updated_phone`, not both. # @return [Object] def resend_reward(id, opts = {}) data, _status_code, _headers = resend_reward_with_http_info(id, opts) @@ -2963,6 +2954,7 @@ def resend_reward(id, opts = {}) # Resends a reward, identified by the given `id` in the URL, to its recipient. # @param id [String] ID of the reward that should be resent # @param [Hash] opts the optional parameters + # @option opts [ResendRewardRequest] :resend_reward_request _Only_ for rewards with a previous delivery failure: You can update the email or phone number used for the resend. You can only provide one of `updated_email` or `updated_phone`, not both. # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers def resend_reward_with_http_info(id, opts = {}) if @api_client.config.debugging @@ -2987,12 +2979,17 @@ def resend_reward_with_http_info(id, opts = {}) header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] + # 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] + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'resend_reward_request']) # return_type return_type = opts[:debug_return_type] || 'Object' @@ -3098,20 +3095,20 @@ def simulate_webhook_with_http_info(id, simulate_webhook_request, opts = {}) # Update campaign # @param id [String] ID of the campaign that should be updated - # @param update_campaign_request [UpdateCampaignRequest] Campaign details + # @param update_campaign [UpdateCampaign] Campaign details # @param [Hash] opts the optional parameters # @return [CreateCampaign201Response] - def update_campaign(id, update_campaign_request, opts = {}) - data, _status_code, _headers = update_campaign_with_http_info(id, update_campaign_request, opts) + def update_campaign(id, update_campaign, opts = {}) + data, _status_code, _headers = update_campaign_with_http_info(id, update_campaign, opts) data end # Update campaign # @param id [String] ID of the campaign that should be updated - # @param update_campaign_request [UpdateCampaignRequest] Campaign details + # @param update_campaign [UpdateCampaign] Campaign details # @param [Hash] opts the optional parameters # @return [Array<(CreateCampaign201Response, Integer, Hash)>] CreateCampaign201Response data, response status code and response headers - def update_campaign_with_http_info(id, update_campaign_request, opts = {}) + def update_campaign_with_http_info(id, update_campaign, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.update_campaign ...' end @@ -3124,9 +3121,9 @@ def update_campaign_with_http_info(id, update_campaign_request, opts = {}) fail ArgumentError, "invalid value for 'id' when calling TremendousApi.update_campaign, must conform to the pattern #{pattern}." end - # verify the required parameter 'update_campaign_request' is set - if @api_client.config.client_side_validation && update_campaign_request.nil? - fail ArgumentError, "Missing the required parameter 'update_campaign_request' when calling TremendousApi.update_campaign" + # verify the required parameter 'update_campaign' is set + if @api_client.config.client_side_validation && update_campaign.nil? + fail ArgumentError, "Missing the required parameter 'update_campaign' when calling TremendousApi.update_campaign" end # resource path local_var_path = '/campaigns/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) @@ -3148,7 +3145,7 @@ def update_campaign_with_http_info(id, update_campaign_request, opts = {}) form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] || @api_client.object_to_http_body(update_campaign_request) + post_body = opts[:debug_body] || @api_client.object_to_http_body(update_campaign) # return_type return_type = opts[:debug_return_type] || 'CreateCampaign201Response' @@ -3178,7 +3175,7 @@ def update_campaign_with_http_info(id, update_campaign_request, opts = {}) # @param rule_type [String] The rule type to create or update. # @param update_fraud_rule_list_request [UpdateFraudRuleListRequest] The lists to add or remove from the current configuration # @param [Hash] opts the optional parameters - # @return [UpdateFraudRuleList200Response] + # @return [FraudGenericResponse] def update_fraud_rule_list(rule_type, update_fraud_rule_list_request, opts = {}) data, _status_code, _headers = update_fraud_rule_list_with_http_info(rule_type, update_fraud_rule_list_request, opts) data @@ -3189,7 +3186,7 @@ def update_fraud_rule_list(rule_type, update_fraud_rule_list_request, opts = {}) # @param rule_type [String] The rule type to create or update. # @param update_fraud_rule_list_request [UpdateFraudRuleListRequest] The lists to add or remove from the current configuration # @param [Hash] opts the optional parameters - # @return [Array<(UpdateFraudRuleList200Response, Integer, Hash)>] UpdateFraudRuleList200Response data, response status code and response headers + # @return [Array<(FraudGenericResponse, Integer, Hash)>] FraudGenericResponse data, response status code and response headers def update_fraud_rule_list_with_http_info(rule_type, update_fraud_rule_list_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TremendousApi.update_fraud_rule_list ...' @@ -3230,7 +3227,7 @@ def update_fraud_rule_list_with_http_info(rule_type, update_fraud_rule_list_requ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_fraud_rule_list_request) # return_type - return_type = opts[:debug_return_type] || 'UpdateFraudRuleList200Response' + return_type = opts[:debug_return_type] || 'FraudGenericResponse' # auth_names auth_names = opts[:debug_auth_names] || ['BearerApiKey'] diff --git a/lib/tremendous/models/base_order_for_create.rb b/lib/tremendous/models/base_order_for_create.rb index a69bc6d..ac6d3ff 100644 --- a/lib/tremendous/models/base_order_for_create.rb +++ b/lib/tremendous/models/base_order_for_create.rb @@ -37,7 +37,7 @@ def self.acceptable_attributes def self.openapi_types { :'external_id' => :'String', - :'payment' => :'SingleRewardOrderPayment' + :'payment' => :'BaseOrderForCreatePayment' } end diff --git a/lib/tremendous/models/base_order_for_create_payment.rb b/lib/tremendous/models/base_order_for_create_payment.rb new file mode 100644 index 0000000..5528e0f --- /dev/null +++ b/lib/tremendous/models/base_order_for_create_payment.rb @@ -0,0 +1,222 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class BaseOrderForCreatePayment + # Tremendous ID of the funding source that will be used to pay for the order. Use `balance` to use your Tremendous's balance. + attr_accessor :funding_source_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'funding_source_id' => :'funding_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 + { + :'funding_source_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 `Tremendous::BaseOrderForCreatePayment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::BaseOrderForCreatePayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'funding_source_id') + self.funding_source_id = attributes[:'funding_source_id'] + else + self.funding_source_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 @funding_source_id.nil? + invalid_properties.push('invalid value for "funding_source_id", funding_source_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 @funding_source_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 && + funding_source_id == o.funding_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 + [funding_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 = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/campaign.rb b/lib/tremendous/models/campaign.rb index 32d74b9..2b712bf 100644 --- a/lib/tremendous/models/campaign.rb +++ b/lib/tremendous/models/campaign.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # With a campaign you can define the look & feel of how rewards are sent out. It also lets you set the available products (different gift cards, charity, etc.) recipients can choose from. class Campaign attr_accessor :id @@ -55,8 +54,8 @@ def self.openapi_types :'name' => :'String', :'description' => :'String', :'products' => :'Array', - :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle', - :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle' + :'webpage_style' => :'CampaignBaseWebpageStyle', + :'email_style' => :'CampaignBaseEmailStyle' } end @@ -67,6 +66,13 @@ def self.openapi_nullable ]) 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 = {}) @@ -88,22 +94,16 @@ def initialize(attributes = {}) if attributes.key?(:'name') self.name = attributes[:'name'] - else - self.name = nil end if attributes.key?(:'description') self.description = attributes[:'description'] - else - self.description = nil end if attributes.key?(:'products') if (value = attributes[:'products']).is_a?(Array) self.products = value end - else - self.products = nil end if attributes.key?(:'webpage_style') @@ -125,14 +125,6 @@ def list_invalid_properties invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") end - if @name.nil? - invalid_properties.push('invalid value for "name", name cannot be nil.') - end - - if @products.nil? - invalid_properties.push('invalid value for "products", products cannot be nil.') - end - invalid_properties end @@ -141,8 +133,6 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) - return false if @name.nil? - return false if @products.nil? true end diff --git a/lib/tremendous/models/campaign_base.rb b/lib/tremendous/models/campaign_base.rb index 87b2590..cf02f5c 100644 --- a/lib/tremendous/models/campaign_base.rb +++ b/lib/tremendous/models/campaign_base.rb @@ -55,8 +55,8 @@ def self.openapi_types :'name' => :'String', :'description' => :'String', :'products' => :'Array', - :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle', - :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle' + :'webpage_style' => :'CampaignBaseWebpageStyle', + :'email_style' => :'CampaignBaseEmailStyle' } end diff --git a/lib/tremendous/models/campaign_base_email_style.rb b/lib/tremendous/models/campaign_base_email_style.rb new file mode 100644 index 0000000..b245239 --- /dev/null +++ b/lib/tremendous/models/campaign_base_email_style.rb @@ -0,0 +1,272 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + # Definition of the email style + class CampaignBaseEmailStyle + # If sending via email, this is how the email will appear to be sent from + attr_accessor :sender_name + + # Email subject line + attr_accessor :subject_line + + # URL of a publicly-accessible image (png, jpeg, jpg, gif, or svg). This image will be copied to our storage location. + attr_accessor :logo_image_url + + # Image height in pixels + attr_accessor :logo_image_height_px + + # Logo backgrond color code (hex, rgb, or rgba) + attr_accessor :logo_background_color + + # Button color code (hex, rgb, or rgba) + attr_accessor :button_color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sender_name' => :'sender_name', + :'subject_line' => :'subject_line', + :'logo_image_url' => :'logo_image_url', + :'logo_image_height_px' => :'logo_image_height_px', + :'logo_background_color' => :'logo_background_color', + :'button_color' => :'button_color' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sender_name' => :'String', + :'subject_line' => :'String', + :'logo_image_url' => :'String', + :'logo_image_height_px' => :'Integer', + :'logo_background_color' => :'String', + :'button_color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'sender_name', + :'subject_line', + :'logo_image_url', + :'logo_image_height_px', + :'logo_background_color', + :'button_color' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CampaignBaseEmailStyle` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CampaignBaseEmailStyle`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sender_name') + self.sender_name = attributes[:'sender_name'] + end + + if attributes.key?(:'subject_line') + self.subject_line = attributes[:'subject_line'] + end + + if attributes.key?(:'logo_image_url') + self.logo_image_url = attributes[:'logo_image_url'] + end + + if attributes.key?(:'logo_image_height_px') + self.logo_image_height_px = attributes[:'logo_image_height_px'] + end + + if attributes.key?(:'logo_background_color') + self.logo_background_color = attributes[:'logo_background_color'] + end + + if attributes.key?(:'button_color') + self.button_color = attributes[:'button_color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sender_name == o.sender_name && + subject_line == o.subject_line && + logo_image_url == o.logo_image_url && + logo_image_height_px == o.logo_image_height_px && + logo_background_color == o.logo_background_color && + button_color == o.button_color + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sender_name, subject_line, logo_image_url, logo_image_height_px, logo_background_color, button_color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/campaign_base_webpage_style.rb b/lib/tremendous/models/campaign_base_webpage_style.rb new file mode 100644 index 0000000..0823e16 --- /dev/null +++ b/lib/tremendous/models/campaign_base_webpage_style.rb @@ -0,0 +1,271 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + # Definition of the webpage style + class CampaignBaseWebpageStyle + # Headline for the reward page + attr_accessor :headline + + # Message for the reward page + attr_accessor :message + + # URL of a publicly-accessible image (png, jpeg, jpg, gif, or svg). This image will be copied to our storage location. + attr_accessor :logo_image_url + + # Image height in pixels + attr_accessor :logo_image_height_px + + # Logo backgrond color code (hex, rgb, or rgba) + attr_accessor :logo_background_color + + # Backgrond color code (hex, rgb, or rgba) + attr_accessor :background_color + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'headline' => :'headline', + :'message' => :'message', + :'logo_image_url' => :'logo_image_url', + :'logo_image_height_px' => :'logo_image_height_px', + :'logo_background_color' => :'logo_background_color', + :'background_color' => :'background_color' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'headline' => :'String', + :'message' => :'String', + :'logo_image_url' => :'String', + :'logo_image_height_px' => :'Integer', + :'logo_background_color' => :'String', + :'background_color' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'headline', + :'logo_image_url', + :'logo_image_height_px', + :'logo_background_color', + :'background_color' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CampaignBaseWebpageStyle` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CampaignBaseWebpageStyle`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'headline') + self.headline = attributes[:'headline'] + end + + if attributes.key?(:'message') + self.message = attributes[:'message'] + end + + if attributes.key?(:'logo_image_url') + self.logo_image_url = attributes[:'logo_image_url'] + end + + if attributes.key?(:'logo_image_height_px') + self.logo_image_height_px = attributes[:'logo_image_height_px'] + end + + if attributes.key?(:'logo_background_color') + self.logo_background_color = attributes[:'logo_background_color'] + end + + if attributes.key?(:'background_color') + self.background_color = attributes[:'background_color'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + headline == o.headline && + message == o.message && + logo_image_url == o.logo_image_url && + logo_image_height_px == o.logo_image_height_px && + logo_background_color == o.logo_background_color && + background_color == o.background_color + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [headline, message, logo_image_url, logo_image_height_px, logo_background_color, background_color].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/create_campaign201_response.rb b/lib/tremendous/models/create_campaign201_response.rb index e8d0470..d74c786 100644 --- a/lib/tremendous/models/create_campaign201_response.rb +++ b/lib/tremendous/models/create_campaign201_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'campaign' => :'ListCampaigns200ResponseCampaignsInner' + :'campaign' => :'Campaign' } end diff --git a/lib/tremendous/models/create_invoice200_response.rb b/lib/tremendous/models/create_invoice200_response.rb index 22e9923..4154b88 100644 --- a/lib/tremendous/models/create_invoice200_response.rb +++ b/lib/tremendous/models/create_invoice200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'invoice' => :'ListInvoices200ResponseInvoicesInner' + :'invoice' => :'Invoice' } end diff --git a/lib/tremendous/models/create_member200_response.rb b/lib/tremendous/models/create_member200_response.rb index 6bbfac3..44e9644 100644 --- a/lib/tremendous/models/create_member200_response.rb +++ b/lib/tremendous/models/create_member200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'member' => :'ListMembers200ResponseMembersInner' + :'member' => :'MemberWithoutEvents' } end diff --git a/lib/tremendous/models/create_organization.rb b/lib/tremendous/models/create_organization.rb index 568545c..05a4a4e 100644 --- a/lib/tremendous/models/create_organization.rb +++ b/lib/tremendous/models/create_organization.rb @@ -59,7 +59,7 @@ def self.openapi_types :'name' => :'String', :'website' => :'String', :'with_api_key' => :'Boolean', - :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'copy_settings' => :'CreateOrganizationCopySettings', :'phone' => :'String', :'created_at' => :'Date' } diff --git a/lib/tremendous/models/create_organization200_response_organization.rb b/lib/tremendous/models/create_organization200_response_organization.rb index ab09a1d..35d66ca 100644 --- a/lib/tremendous/models/create_organization200_response_organization.rb +++ b/lib/tremendous/models/create_organization200_response_organization.rb @@ -23,6 +23,9 @@ class CreateOrganization200ResponseOrganization # URL of the website of that organization attr_accessor :website + # Default value is `false`. Set to true to also generate an API key associated to the new organization. + attr_accessor :with_api_key + attr_accessor :copy_settings # Phone number of the organization. For non-US phone numbers, specify the country code (prefixed with +). @@ -40,6 +43,7 @@ def self.attribute_map :'id' => :'id', :'name' => :'name', :'website' => :'website', + :'with_api_key' => :'with_api_key', :'copy_settings' => :'copy_settings', :'phone' => :'phone', :'created_at' => :'created_at', @@ -58,7 +62,8 @@ def self.openapi_types :'id' => :'String', :'name' => :'String', :'website' => :'String', - :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'with_api_key' => :'Boolean', + :'copy_settings' => :'CreateOrganizationCopySettings', :'phone' => :'String', :'created_at' => :'Date', :'api_key' => :'String' @@ -72,6 +77,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'CreateOrganizationForResponse' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -103,6 +115,10 @@ def initialize(attributes = {}) self.website = nil end + if attributes.key?(:'with_api_key') + self.with_api_key = attributes[:'with_api_key'] + end + if attributes.key?(:'copy_settings') self.copy_settings = attributes[:'copy_settings'] end @@ -174,6 +190,7 @@ def ==(o) id == o.id && name == o.name && website == o.website && + with_api_key == o.with_api_key && copy_settings == o.copy_settings && phone == o.phone && created_at == o.created_at && @@ -189,7 +206,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, name, website, copy_settings, phone, created_at, api_key].hash + [id, name, website, with_api_key, copy_settings, phone, created_at, api_key].hash end # Builds the object from hash diff --git a/lib/tremendous/models/create_organization_copy_settings.rb b/lib/tremendous/models/create_organization_copy_settings.rb new file mode 100644 index 0000000..a1d8b1a --- /dev/null +++ b/lib/tremendous/models/create_organization_copy_settings.rb @@ -0,0 +1,302 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + # A list of the settings that you wish to copy over to the new organization. + class CreateOrganizationCopySettings + # Copy over the campaigns from the current organization to the new organization. Defaults to `false`. + attr_accessor :campaigns + + # Copy over the custom fields from the current organization to the new organization. Defaults to `false`. + attr_accessor :custom_fields + + # Copy over the order approvals settings from the current organization to the new organization. Defaults to `false`. + attr_accessor :order_approvals + + # Copy over the payment methods from the current organization to the new organization. Defaults to `false`. + attr_accessor :payment_methods + + # Copy over the security settings from the current organization to the new organization. Defaults to `true`. + attr_accessor :security_settings + + # Copy over the users and custom roles from the current organization to the new organization. Defaults to `false`. + attr_accessor :users + + # Copy over the custom roles from the current organization to the new organization. Custom roles are always copied if `users` is `true`. Defaults to `false`. + attr_accessor :custom_roles + + # Copy over the fraud prevention settings and rules from the current organization to the new organization. Defaults to `false`. + attr_accessor :fraud_prevention + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaigns' => :'campaigns', + :'custom_fields' => :'custom_fields', + :'order_approvals' => :'order_approvals', + :'payment_methods' => :'payment_methods', + :'security_settings' => :'security_settings', + :'users' => :'users', + :'custom_roles' => :'custom_roles', + :'fraud_prevention' => :'fraud_prevention' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaigns' => :'Boolean', + :'custom_fields' => :'Boolean', + :'order_approvals' => :'Boolean', + :'payment_methods' => :'Boolean', + :'security_settings' => :'Boolean', + :'users' => :'Boolean', + :'custom_roles' => :'Boolean', + :'fraud_prevention' => :'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 `Tremendous::CreateOrganizationCopySettings` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateOrganizationCopySettings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'campaigns') + self.campaigns = attributes[:'campaigns'] + else + self.campaigns = false + end + + if attributes.key?(:'custom_fields') + self.custom_fields = attributes[:'custom_fields'] + else + self.custom_fields = false + end + + if attributes.key?(:'order_approvals') + self.order_approvals = attributes[:'order_approvals'] + else + self.order_approvals = false + end + + if attributes.key?(:'payment_methods') + self.payment_methods = attributes[:'payment_methods'] + else + self.payment_methods = false + end + + if attributes.key?(:'security_settings') + self.security_settings = attributes[:'security_settings'] + else + self.security_settings = true + end + + if attributes.key?(:'users') + self.users = attributes[:'users'] + else + self.users = false + end + + if attributes.key?(:'custom_roles') + self.custom_roles = attributes[:'custom_roles'] + else + self.custom_roles = false + end + + if attributes.key?(:'fraud_prevention') + self.fraud_prevention = attributes[:'fraud_prevention'] + else + self.fraud_prevention = false + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaigns == o.campaigns && + custom_fields == o.custom_fields && + order_approvals == o.order_approvals && + payment_methods == o.payment_methods && + security_settings == o.security_settings && + users == o.users && + custom_roles == o.custom_roles && + fraud_prevention == o.fraud_prevention + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaigns, custom_fields, order_approvals, payment_methods, security_settings, users, custom_roles, fraud_prevention].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/create_organization_for_response.rb b/lib/tremendous/models/create_organization_for_response.rb index 2241cc2..7198077 100644 --- a/lib/tremendous/models/create_organization_for_response.rb +++ b/lib/tremendous/models/create_organization_for_response.rb @@ -59,7 +59,7 @@ def self.openapi_types :'name' => :'String', :'website' => :'String', :'with_api_key' => :'Boolean', - :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'copy_settings' => :'CreateOrganizationCopySettings', :'phone' => :'String', :'created_at' => :'Date' } diff --git a/lib/tremendous/models/create_organization_properties.rb b/lib/tremendous/models/create_organization_properties.rb index 880cfbe..29f1c4d 100644 --- a/lib/tremendous/models/create_organization_properties.rb +++ b/lib/tremendous/models/create_organization_properties.rb @@ -59,7 +59,7 @@ def self.openapi_types :'name' => :'String', :'website' => :'String', :'with_api_key' => :'Boolean', - :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'copy_settings' => :'CreateOrganizationCopySettings', :'phone' => :'String', :'created_at' => :'Date' } diff --git a/lib/tremendous/models/create_webhook200_response.rb b/lib/tremendous/models/create_webhook200_response.rb index 9c3df4c..1f81b69 100644 --- a/lib/tremendous/models/create_webhook200_response.rb +++ b/lib/tremendous/models/create_webhook200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'webhook' => :'ListWebhooks200ResponseWebhooksInner' + :'webhook' => :'Webhook' } end diff --git a/lib/tremendous/models/custom_field.rb b/lib/tremendous/models/custom_field.rb index 9ae64d0..40067c0 100644 --- a/lib/tremendous/models/custom_field.rb +++ b/lib/tremendous/models/custom_field.rb @@ -16,7 +16,6 @@ module Tremendous # Reward custom data for searching, tracking or copy (see [Adding custom fields to orders](https://developers.tremendous.com/reference/using-custom-fields-to-add-custom-data-to-rewards).) class CustomField - # Tremendous ID of the custom field attr_accessor :id # Value of the custom field diff --git a/lib/tremendous/models/delivery_details.rb b/lib/tremendous/models/delivery_details.rb index beb8f69..e533804 100644 --- a/lib/tremendous/models/delivery_details.rb +++ b/lib/tremendous/models/delivery_details.rb @@ -16,10 +16,8 @@ module Tremendous # Details on how the reward is delivered to the recipient. class DeliveryDetails - # How to deliver the reward to the recipient.
Delivery Method Description
EMAIL Deliver the reward to the recipient by email
LINK

Deliver the reward to the recipient via a link.

The link can be retrieved on a successfully ordered reward via the /rewards or /rewards/{id} endpoint. That link must then be delivered to the recipient out-of-band.

PHONE Deliver the reward to the recipient by SMS
attr_accessor :method - # Current status of the delivery of the reward: * `SCHEDULED` - Reward is scheduled for delivery and will be delivered soon. * `FAILED` - Delivery of reward failed (e.g. email bounced). * `SUCCEEDED` - Reward was successfully delivered (email or text message delivered or reward link opened). * `PENDING` - Delivery is pending but not yet scheduled. attr_accessor :status class EnumAttributeValidator @@ -60,8 +58,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'method' => :'String', - :'status' => :'String' + :'method' => :'DeliveryMethod', + :'status' => :'DeliveryStatus' } end @@ -107,33 +105,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - method_validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) - return false unless method_validator.valid?(@method) - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) - return false unless status_validator.valid?(@status) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] method Object to be assigned - def method=(method) - validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) - unless validator.valid?(method) - fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}." - end - @method = method - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) - 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) diff --git a/lib/tremendous/models/delivery_details_with_link.rb b/lib/tremendous/models/delivery_details_with_link.rb index 31b78f8..2cf2f45 100644 --- a/lib/tremendous/models/delivery_details_with_link.rb +++ b/lib/tremendous/models/delivery_details_with_link.rb @@ -16,10 +16,8 @@ module Tremendous # Details on how the reward is delivered to the recipient. class DeliveryDetailsWithLink - # How to deliver the reward to the recipient.
Delivery Method Description
EMAIL Deliver the reward to the recipient by email
LINK

Deliver the reward to the recipient via a link.

The link can be retrieved on a successfully ordered reward via the /rewards or /rewards/{id} endpoint. That link must then be delivered to the recipient out-of-band.

PHONE Deliver the reward to the recipient by SMS
attr_accessor :method - # Current status of the delivery of the reward: * `SCHEDULED` - Reward is scheduled for delivery and will be delivered soon. * `FAILED` - Delivery of reward failed (e.g. email bounced). * `SUCCEEDED` - Reward was successfully delivered (email or text message delivered or reward link opened). * `PENDING` - Delivery is pending but not yet scheduled. attr_accessor :status # Link to redeem the reward at. You need to deliver this link to the recipient. @@ -64,8 +62,8 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'method' => :'String', - :'status' => :'String', + :'method' => :'DeliveryMethod', + :'status' => :'DeliveryStatus', :'link' => :'String' } end @@ -129,34 +127,10 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @method.nil? - method_validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) - return false unless method_validator.valid?(@method) return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) - return false unless status_validator.valid?(@status) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] method Object to be assigned - def method=(method) - validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) - unless validator.valid?(method) - fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}." - end - @method = method - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) - 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) diff --git a/lib/tremendous/models/error_model.rb b/lib/tremendous/models/error_model.rb index 94c75b9..75bcea7 100644 --- a/lib/tremendous/models/error_model.rb +++ b/lib/tremendous/models/error_model.rb @@ -37,7 +37,7 @@ def self.acceptable_attributes def self.openapi_types { :'status' => :'Integer', - :'errors' => :'ListRewards401ResponseErrors' + :'errors' => :'ErrorModelErrors' } end diff --git a/lib/tremendous/models/error_model_errors.rb b/lib/tremendous/models/error_model_errors.rb new file mode 100644 index 0000000..1682ebd --- /dev/null +++ b/lib/tremendous/models/error_model_errors.rb @@ -0,0 +1,227 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class ErrorModelErrors + # Error message + attr_accessor :message + + # Mirrors the request parameters structure, filled only with the (nested) properties that caused an error. + attr_accessor :payload + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'message' => :'message', + :'payload' => :'payload' + } + end + + # 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', + :'payload' => :'Hash' + } + 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 `Tremendous::ErrorModelErrors` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ErrorModelErrors`. Please check the name 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 + + if attributes.key?(:'payload') + if (value = attributes[:'payload']).is_a?(Hash) + self.payload = 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 && + message == o.message && + payload == o.payload + end + + # @see the `==` method + # @param [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, payload].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/fraud_review.rb b/lib/tremendous/models/fraud_review.rb index 4f723f1..2efdb6d 100644 --- a/lib/tremendous/models/fraud_review.rb +++ b/lib/tremendous/models/fraud_review.rb @@ -16,7 +16,6 @@ module Tremendous # The fraud review associated with a reward. class FraudReview - # The current status of the fraud review: * `flagged` - The reward has been flagged for and waiting manual review. * `blocked` - The reward was reviewed and blocked. * `released` - The reward was reviewed and released. attr_accessor :status # The array may contain multiple reasons, depending on which rule(s) flagged the reward for review. Reasons can be any of the following: * `Disallowed IP` * `Disallowed email` * `Disallowed country` * `Over reward dollar limit` * `Over reward count limit` * `VPN detected` * `Device related to multiple emails` * `Device or account related to multiple emails` * `IP on a Tremendous fraud list` * `Bank account on a Tremendous fraud list` * `Fingerprint on a Tremendous fraud list` * `Email on a Tremendous fraud list` * `Phone on a Tremendous fraud list` * `IP related to a blocked reward` * `Bank account related to a blocked reward` * `Fingerprint related to a blocked reward` * `Email related to a blocked reward` * `Phone related to a blocked reward` * `Allowed IP` * `Allowed email` @@ -33,7 +32,6 @@ class FraudReview # The device fingerprint, if known. attr_accessor :device_id - # The product selected to claim the reward attr_accessor :redemption_method # Date the reward was redeemed @@ -89,16 +87,16 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'status' => :'String', - :'reasons' => :'Array', + :'status' => :'FraudReviewStatus', + :'reasons' => :'Array', :'reviewed_by' => :'String', :'reviewed_at' => :'Time', - :'related_rewards' => :'GetFraudReview200ResponseFraudReviewRelatedRewards', + :'related_rewards' => :'FraudReviewRelatedRewards', :'device_id' => :'String', - :'redemption_method' => :'String', + :'redemption_method' => :'FraudReviewRedemptionMethod', :'redeemed_at' => :'Time', - :'geo' => :'GetFraudReview200ResponseFraudReviewGeo', - :'reward' => :'OrderWithoutLinkRewardsInner' + :'geo' => :'FraudReviewGeo', + :'reward' => :'RewardWithoutLink' } end @@ -178,33 +176,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"]) - return false unless status_validator.valid?(@status) - redemption_method_validator = EnumAttributeValidator.new('String', ["paypal", "bank", "merchant card", "visa card", "charity", "venmo"]) - return false unless redemption_method_validator.valid?(@redemption_method) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"]) - 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] redemption_method Object to be assigned - def redemption_method=(redemption_method) - validator = EnumAttributeValidator.new('String', ["paypal", "bank", "merchant card", "visa card", "charity", "venmo"]) - unless validator.valid?(redemption_method) - fail ArgumentError, "invalid value for \"redemption_method\", must be one of #{validator.allowable_values}." - end - @redemption_method = redemption_method - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/fraud_review_list_item.rb b/lib/tremendous/models/fraud_review_list_item.rb index 765dd54..5b81d04 100644 --- a/lib/tremendous/models/fraud_review_list_item.rb +++ b/lib/tremendous/models/fraud_review_list_item.rb @@ -16,7 +16,6 @@ module Tremendous # The fraud review associated with a reward. class FraudReviewListItem - # The current status of the fraud review: * `flagged` - The reward has been flagged for and waiting manual review. * `blocked` - The reward was reviewed and blocked. * `released` - The reward was reviewed and released. attr_accessor :status # The array may contain multiple reasons, depending on which rule(s) flagged the reward for review. Reasons can be any of the following: * `Disallowed IP` * `Disallowed email` * `Disallowed country` * `Over reward dollar limit` * `Over reward count limit` * `VPN detected` * `Device related to multiple emails` * `Device or account related to multiple emails` * `IP on a Tremendous fraud list` * `Bank account on a Tremendous fraud list` * `Fingerprint on a Tremendous fraud list` * `Email on a Tremendous fraud list` * `Phone on a Tremendous fraud list` * `IP related to a blocked reward` * `Bank account related to a blocked reward` * `Fingerprint related to a blocked reward` * `Email related to a blocked reward` * `Phone related to a blocked reward` * `Allowed IP` * `Allowed email` @@ -63,9 +62,9 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'status' => :'String', - :'reasons' => :'Array', - :'reward' => :'OrderWithoutLinkRewardsInner' + :'status' => :'FraudReviewStatus', + :'reasons' => :'Array', + :'reward' => :'RewardWithoutLink' } end @@ -117,21 +116,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - status_validator = EnumAttributeValidator.new('String', ["flagged", "blocked", "released"]) - 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', ["flagged", "blocked", "released"]) - 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) diff --git a/lib/tremendous/models/fraud_rule_request_config.rb b/lib/tremendous/models/fraud_rule_request_config.rb index 4fa0dff..723b98e 100644 --- a/lib/tremendous/models/fraud_rule_request_config.rb +++ b/lib/tremendous/models/fraud_rule_request_config.rb @@ -20,13 +20,12 @@ class << self # List of class defined in anyOf (OpenAPI v3) def openapi_any_of [ - :'AllowEmail', - :'AllowIp', - :'ReviewCountry', - :'ReviewEmail', - :'ReviewIp', - :'ReviewRedeemedRewardsAmount', - :'ReviewRedeemedRewardsCount' + :'FraudConfigAllowEmail', + :'FraudConfigCountry', + :'FraudConfigIP', + :'FraudConfigRedeemedRewardsAmount', + :'FraudConfigRedeemedRewardsCount', + :'FraudConfigReviewEmail' ] end diff --git a/lib/tremendous/models/fraud_rules_list_item.rb b/lib/tremendous/models/fraud_rules_list_item.rb index be68916..62fb644 100644 --- a/lib/tremendous/models/fraud_rules_list_item.rb +++ b/lib/tremendous/models/fraud_rules_list_item.rb @@ -16,7 +16,6 @@ module Tremendous # An active fraud rule class FraudRulesListItem - # * `review_country` - Flags when the recipient's IP country matches the criteria in the rule * `review_ip` - Flags when recipient's IP matches one in the list * `review_email` - Flags when the recipient's email matches one in the list * `review_redeemed_rewards_count` - Flags when the recipient redeemed more than the number of rewards specified in the config * `review_redeemed_rewards_amount` - Flags when the recipient redeemed more than the total amount specified in the config * `review_multiple_emails` - Flags when recipient's device or account has multiple emails associated * `review_vpn` - Flags when VPN is suspected * `review_tremendous_flag_list` - Flags rewards when redemption attributes match at least one criteria defined by the Tremendous flag list * `review_previously_blocked_recipients` - Flags rewards when the recipient has been blocked before * `allow_ip` - Releases a reward when a recipient's IP matches one in the list * `allow_email` - Releases a reward when the recipient's email matches one in the list attr_accessor :rule_type # The configuration associated with the rule. The properties allowed depend on the type of rule. This property is only present for rules that require configuration. @@ -60,7 +59,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'rule_type' => :'String', + :'rule_type' => :'FraudRuleType', :'config' => :'Hash' } end @@ -110,21 +109,9 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - rule_type_validator = EnumAttributeValidator.new('String', ["review_country", "review_ip", "review_email", "review_redeemed_rewards_count", "review_redeemed_rewards_amount", "review_multiple_emails", "review_vpn", "review_tremendous_flag_list", "review_previously_blocked_recipients", "allow_ip", "allow_email"]) - return false unless rule_type_validator.valid?(@rule_type) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] rule_type Object to be assigned - def rule_type=(rule_type) - validator = EnumAttributeValidator.new('String', ["review_country", "review_ip", "review_email", "review_redeemed_rewards_count", "review_redeemed_rewards_amount", "review_multiple_emails", "review_vpn", "review_tremendous_flag_list", "review_previously_blocked_recipients", "allow_ip", "allow_email"]) - unless validator.valid?(rule_type) - fail ArgumentError, "invalid value for \"rule_type\", must be one of #{validator.allowable_values}." - end - @rule_type = rule_type - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/funding_source.rb b/lib/tremendous/models/funding_source.rb index 60958ab..c541899 100644 --- a/lib/tremendous/models/funding_source.rb +++ b/lib/tremendous/models/funding_source.rb @@ -69,7 +69,7 @@ def self.openapi_types :'id' => :'String', :'method' => :'String', :'type' => :'String', - :'meta' => :'ListFundingSources200ResponseFundingSourcesInnerMeta' + :'meta' => :'FundingSourceMeta' } end diff --git a/lib/tremendous/models/funding_source_meta.rb b/lib/tremendous/models/funding_source_meta.rb new file mode 100644 index 0000000..2715e38 --- /dev/null +++ b/lib/tremendous/models/funding_source_meta.rb @@ -0,0 +1,466 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class FundingSourceMeta + # **Only available when `method` is set to `balance`.** Available amount for this funding source (in Cents USD) + attr_accessor :available_cents + + # **Only available when `method` is set to `balance`.** Funds that are already registered on your Tremendous account but which have not yet been deposited in your account (e.g. unpaid invoices) (in Cents USD). + attr_accessor :pending_cents + + # **Only available when `method` is set to `bank_account` or `credit_card`.** Name of the holder of the bank account or credit_card + attr_accessor :accountholder_name + + # **Only available when `method` is set to `bank_account`.** Is this a checking or savings account + attr_accessor :account_type + + # **Only available when `method` is set to `bank_account`.** Name of the bank + attr_accessor :bank_name + + # **Only available when `method` is set to `bank_account`.** Last 4 digits of the account number + attr_accessor :account_number_mask + + # **Only available when `method` is set to `bank_account`.** Last 4 digits of the routing number + attr_accessor :account_routing_mask + + # **Only available when `method` is set to `bank_account`.** Can refunds be deposited to this bank account + attr_accessor :refundable + + # **Only available when `method` is set to `credit_card`.** Network of the credit card + attr_accessor :network + + # **Only available when `method` is set to `credit_card`.** Last 4 digits of the credit card number + attr_accessor :last4 + + # **Only available when `method` is set to `credit_card`.** Is this credit card expired + attr_accessor :expired + + # **Only available when `method` is set to `credit_card`.** Year part of card's expiration date + attr_accessor :year + + # **Only available when `method` is set to `credit_card`.** Month part of card's expiration date + attr_accessor :month + + # **Only available when `method` is set to `bank_account` or `credit_card`.** Point in time when the last order failed using this bank account or credit card as a funding source. + attr_accessor :last_payment_failed_at + + attr_accessor :failure_details + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'available_cents' => :'available_cents', + :'pending_cents' => :'pending_cents', + :'accountholder_name' => :'accountholder_name', + :'account_type' => :'account_type', + :'bank_name' => :'bank_name', + :'account_number_mask' => :'account_number_mask', + :'account_routing_mask' => :'account_routing_mask', + :'refundable' => :'refundable', + :'network' => :'network', + :'last4' => :'last4', + :'expired' => :'expired', + :'year' => :'year', + :'month' => :'month', + :'last_payment_failed_at' => :'last_payment_failed_at', + :'failure_details' => :'failure_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 + { + :'available_cents' => :'Integer', + :'pending_cents' => :'Integer', + :'accountholder_name' => :'String', + :'account_type' => :'String', + :'bank_name' => :'String', + :'account_number_mask' => :'String', + :'account_routing_mask' => :'String', + :'refundable' => :'Boolean', + :'network' => :'String', + :'last4' => :'String', + :'expired' => :'Boolean', + :'year' => :'String', + :'month' => :'String', + :'last_payment_failed_at' => :'Time', + :'failure_details' => :'FundingSourceMetaFailureDetails' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'bank_name', + :'last_payment_failed_at', + :'failure_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 `Tremendous::FundingSourceMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::FundingSourceMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'available_cents') + self.available_cents = attributes[:'available_cents'] + end + + if attributes.key?(:'pending_cents') + self.pending_cents = attributes[:'pending_cents'] + end + + if attributes.key?(:'accountholder_name') + self.accountholder_name = attributes[:'accountholder_name'] + end + + if attributes.key?(:'account_type') + self.account_type = attributes[:'account_type'] + end + + if attributes.key?(:'bank_name') + self.bank_name = attributes[:'bank_name'] + end + + if attributes.key?(:'account_number_mask') + self.account_number_mask = attributes[:'account_number_mask'] + end + + if attributes.key?(:'account_routing_mask') + self.account_routing_mask = attributes[:'account_routing_mask'] + end + + if attributes.key?(:'refundable') + self.refundable = attributes[:'refundable'] + end + + if attributes.key?(:'network') + self.network = attributes[:'network'] + end + + if attributes.key?(:'last4') + self.last4 = attributes[:'last4'] + end + + if attributes.key?(:'expired') + self.expired = attributes[:'expired'] + end + + if attributes.key?(:'year') + self.year = attributes[:'year'] + end + + if attributes.key?(:'month') + self.month = attributes[:'month'] + end + + if attributes.key?(:'last_payment_failed_at') + self.last_payment_failed_at = attributes[:'last_payment_failed_at'] + end + + if attributes.key?(:'failure_details') + self.failure_details = attributes[:'failure_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 + pattern = Regexp.new(/[0-9]{4}/) + if !@account_number_mask.nil? && @account_number_mask !~ pattern + invalid_properties.push("invalid value for \"account_number_mask\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/[0-9]{4}/) + if !@account_routing_mask.nil? && @account_routing_mask !~ pattern + invalid_properties.push("invalid value for \"account_routing_mask\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/[0-9]{4}/) + if !@last4.nil? && @last4 !~ pattern + invalid_properties.push("invalid value for \"last4\", 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' + account_type_validator = EnumAttributeValidator.new('String', ["checking", "savings"]) + return false unless account_type_validator.valid?(@account_type) + return false if !@account_number_mask.nil? && @account_number_mask !~ Regexp.new(/[0-9]{4}/) + return false if !@account_routing_mask.nil? && @account_routing_mask !~ Regexp.new(/[0-9]{4}/) + network_validator = EnumAttributeValidator.new('String', ["MasterCard", "Amex", "JCB", "Diner's Club", "Visa", "Discover", "Laser", "Elo", "Maestro", "Solo"]) + return false unless network_validator.valid?(@network) + return false if !@last4.nil? && @last4 !~ Regexp.new(/[0-9]{4}/) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] account_type Object to be assigned + def account_type=(account_type) + validator = EnumAttributeValidator.new('String', ["checking", "savings"]) + unless validator.valid?(account_type) + fail ArgumentError, "invalid value for \"account_type\", must be one of #{validator.allowable_values}." + end + @account_type = account_type + end + + # Custom attribute writer method with validation + # @param [Object] account_number_mask Value to be assigned + def account_number_mask=(account_number_mask) + if account_number_mask.nil? + fail ArgumentError, 'account_number_mask cannot be nil' + end + + pattern = Regexp.new(/[0-9]{4}/) + if account_number_mask !~ pattern + fail ArgumentError, "invalid value for \"account_number_mask\", must conform to the pattern #{pattern}." + end + + @account_number_mask = account_number_mask + end + + # Custom attribute writer method with validation + # @param [Object] account_routing_mask Value to be assigned + def account_routing_mask=(account_routing_mask) + if account_routing_mask.nil? + fail ArgumentError, 'account_routing_mask cannot be nil' + end + + pattern = Regexp.new(/[0-9]{4}/) + if account_routing_mask !~ pattern + fail ArgumentError, "invalid value for \"account_routing_mask\", must conform to the pattern #{pattern}." + end + + @account_routing_mask = account_routing_mask + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] network Object to be assigned + def network=(network) + validator = EnumAttributeValidator.new('String', ["MasterCard", "Amex", "JCB", "Diner's Club", "Visa", "Discover", "Laser", "Elo", "Maestro", "Solo"]) + unless validator.valid?(network) + fail ArgumentError, "invalid value for \"network\", must be one of #{validator.allowable_values}." + end + @network = network + end + + # Custom attribute writer method with validation + # @param [Object] last4 Value to be assigned + def last4=(last4) + if last4.nil? + fail ArgumentError, 'last4 cannot be nil' + end + + pattern = Regexp.new(/[0-9]{4}/) + if last4 !~ pattern + fail ArgumentError, "invalid value for \"last4\", must conform to the pattern #{pattern}." + end + + @last4 = last4 + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + available_cents == o.available_cents && + pending_cents == o.pending_cents && + accountholder_name == o.accountholder_name && + account_type == o.account_type && + bank_name == o.bank_name && + account_number_mask == o.account_number_mask && + account_routing_mask == o.account_routing_mask && + refundable == o.refundable && + network == o.network && + last4 == o.last4 && + expired == o.expired && + year == o.year && + month == o.month && + last_payment_failed_at == o.last_payment_failed_at && + failure_details == o.failure_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 + [available_cents, pending_cents, accountholder_name, account_type, bank_name, account_number_mask, account_routing_mask, refundable, network, last4, expired, year, month, last_payment_failed_at, failure_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 = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/funding_source_meta_failure_details.rb b/lib/tremendous/models/funding_source_meta_failure_details.rb new file mode 100644 index 0000000..c58a7f9 --- /dev/null +++ b/lib/tremendous/models/funding_source_meta_failure_details.rb @@ -0,0 +1,225 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class FundingSourceMetaFailureDetails + # Payment error code + attr_accessor :return_code + + # Explanation of the payment error + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'return_code' => :'return_code', + :'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 + { + :'return_code' => :'String', + :'description' => :'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 `Tremendous::FundingSourceMetaFailureDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::FundingSourceMetaFailureDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'return_code') + self.return_code = attributes[:'return_code'] + 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 && + return_code == o.return_code && + 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 + [return_code, 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 = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/generate_reward_link200_response.rb b/lib/tremendous/models/generate_reward_link200_response.rb index 1b4e2f8..10ae8b6 100644 --- a/lib/tremendous/models/generate_reward_link200_response.rb +++ b/lib/tremendous/models/generate_reward_link200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'reward' => :'GenerateRewardLink200ResponseReward' + :'reward' => :'RewardLink' } end diff --git a/lib/tremendous/models/generate_reward_token200_response.rb b/lib/tremendous/models/generate_reward_token200_response.rb index eef4344..a1cb26c 100644 --- a/lib/tremendous/models/generate_reward_token200_response.rb +++ b/lib/tremendous/models/generate_reward_token200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'reward' => :'GenerateRewardToken200ResponseReward' + :'reward' => :'RewardToken' } end diff --git a/lib/tremendous/models/get_fraud_review200_response.rb b/lib/tremendous/models/get_fraud_review200_response.rb index 6b24a19..5a6b915 100644 --- a/lib/tremendous/models/get_fraud_review200_response.rb +++ b/lib/tremendous/models/get_fraud_review200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'fraud_review' => :'GetFraudReview200ResponseFraudReview' + :'fraud_review' => :'FraudReview' } end diff --git a/lib/tremendous/models/get_funding_source200_response.rb b/lib/tremendous/models/get_funding_source200_response.rb index 31e0ff1..4f1abf3 100644 --- a/lib/tremendous/models/get_funding_source200_response.rb +++ b/lib/tremendous/models/get_funding_source200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'funding_source' => :'ListFundingSources200ResponseFundingSourcesInner' + :'funding_source' => :'FundingSource' } end diff --git a/lib/tremendous/models/get_member200_response.rb b/lib/tremendous/models/get_member200_response.rb index 06de682..bda3a06 100644 --- a/lib/tremendous/models/get_member200_response.rb +++ b/lib/tremendous/models/get_member200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'member' => :'GetMember200ResponseMember' + :'member' => :'MemberWithEvents' } end diff --git a/lib/tremendous/models/get_organization200_response.rb b/lib/tremendous/models/get_organization200_response.rb index b8b4368..2743ce2 100644 --- a/lib/tremendous/models/get_organization200_response.rb +++ b/lib/tremendous/models/get_organization200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'organization' => :'ListOrganizations200ResponseOrganizationsInner' + :'organization' => :'Organization' } end diff --git a/lib/tremendous/models/get_product_response.rb b/lib/tremendous/models/get_product_response.rb index 93d3466..edb3494 100644 --- a/lib/tremendous/models/get_product_response.rb +++ b/lib/tremendous/models/get_product_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'product' => :'ListProductsResponseProductsInner' + :'product' => :'Product' } end diff --git a/lib/tremendous/models/get_reward200_response.rb b/lib/tremendous/models/get_reward200_response.rb index 48ff09c..ece3c92 100644 --- a/lib/tremendous/models/get_reward200_response.rb +++ b/lib/tremendous/models/get_reward200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'reward' => :'ListRewards200ResponseRewardsInner' + :'reward' => :'RewardWithoutLink' } end diff --git a/lib/tremendous/models/list_balance_transactions200_response.rb b/lib/tremendous/models/list_balance_transactions200_response.rb index 8445d2b..9c5e764 100644 --- a/lib/tremendous/models/list_balance_transactions200_response.rb +++ b/lib/tremendous/models/list_balance_transactions200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'transactions' => :'Array' + :'transactions' => :'Array' } end diff --git a/lib/tremendous/models/list_campaigns200_response.rb b/lib/tremendous/models/list_campaigns200_response.rb index fb1f9d5..358defc 100644 --- a/lib/tremendous/models/list_campaigns200_response.rb +++ b/lib/tremendous/models/list_campaigns200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'campaigns' => :'Array' + :'campaigns' => :'Array' } end diff --git a/lib/tremendous/models/list_fields200_response.rb b/lib/tremendous/models/list_fields200_response.rb index 38c92fb..e01b246 100644 --- a/lib/tremendous/models/list_fields200_response.rb +++ b/lib/tremendous/models/list_fields200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'fields' => :'Array' + :'fields' => :'Array' } end diff --git a/lib/tremendous/models/list_fraud_reviews200_response.rb b/lib/tremendous/models/list_fraud_reviews200_response.rb index 4390e75..30ed508 100644 --- a/lib/tremendous/models/list_fraud_reviews200_response.rb +++ b/lib/tremendous/models/list_fraud_reviews200_response.rb @@ -36,7 +36,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'fraud_reviews' => :'Array', + :'fraud_reviews' => :'Array', :'total_count' => :'Integer' } end diff --git a/lib/tremendous/models/list_fraud_rules200_response.rb b/lib/tremendous/models/list_fraud_rules200_response.rb index 7b91882..f01546b 100644 --- a/lib/tremendous/models/list_fraud_rules200_response.rb +++ b/lib/tremendous/models/list_fraud_rules200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'fraud_rules' => :'Array' + :'fraud_rules' => :'Array' } end diff --git a/lib/tremendous/models/list_funding_sources200_response.rb b/lib/tremendous/models/list_funding_sources200_response.rb index 5f529fc..96c4fff 100644 --- a/lib/tremendous/models/list_funding_sources200_response.rb +++ b/lib/tremendous/models/list_funding_sources200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'funding_sources' => :'Array' + :'funding_sources' => :'Array' } end diff --git a/lib/tremendous/models/list_invoices200_response.rb b/lib/tremendous/models/list_invoices200_response.rb index 5f047df..5c56052 100644 --- a/lib/tremendous/models/list_invoices200_response.rb +++ b/lib/tremendous/models/list_invoices200_response.rb @@ -36,7 +36,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'invoices' => :'Array', + :'invoices' => :'Array', :'total_count' => :'Integer' } end diff --git a/lib/tremendous/models/list_members200_response.rb b/lib/tremendous/models/list_members200_response.rb index 883195b..44ab107 100644 --- a/lib/tremendous/models/list_members200_response.rb +++ b/lib/tremendous/models/list_members200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'members' => :'Array' + :'members' => :'Array' } end diff --git a/lib/tremendous/models/list_orders200_response.rb b/lib/tremendous/models/list_orders200_response.rb index ac9a3e0..9092c0d 100644 --- a/lib/tremendous/models/list_orders200_response.rb +++ b/lib/tremendous/models/list_orders200_response.rb @@ -36,7 +36,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'orders' => :'Array', + :'orders' => :'Array', :'total_count' => :'Integer' } end diff --git a/lib/tremendous/models/list_organizations200_response.rb b/lib/tremendous/models/list_organizations200_response.rb index e9145f0..288ec09 100644 --- a/lib/tremendous/models/list_organizations200_response.rb +++ b/lib/tremendous/models/list_organizations200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'organizations' => :'Array' + :'organizations' => :'Array' } end diff --git a/lib/tremendous/models/list_products_response.rb b/lib/tremendous/models/list_products_response.rb index f35220b..953d7d1 100644 --- a/lib/tremendous/models/list_products_response.rb +++ b/lib/tremendous/models/list_products_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'products' => :'Array' + :'products' => :'Array' } end diff --git a/lib/tremendous/models/list_rewards200_response.rb b/lib/tremendous/models/list_rewards200_response.rb index 3abc10a..21576a9 100644 --- a/lib/tremendous/models/list_rewards200_response.rb +++ b/lib/tremendous/models/list_rewards200_response.rb @@ -36,7 +36,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'rewards' => :'Array', + :'rewards' => :'Array', :'total_count' => :'Integer' } end diff --git a/lib/tremendous/models/list_roles200_response.rb b/lib/tremendous/models/list_roles200_response.rb index df2b020..432ad3b 100644 --- a/lib/tremendous/models/list_roles200_response.rb +++ b/lib/tremendous/models/list_roles200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'roles' => :'Array' + :'roles' => :'Array' } end diff --git a/lib/tremendous/models/list_webhooks200_response.rb b/lib/tremendous/models/list_webhooks200_response.rb index 1c9a9de..2f109dd 100644 --- a/lib/tremendous/models/list_webhooks200_response.rb +++ b/lib/tremendous/models/list_webhooks200_response.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'webhooks' => :'Array' + :'webhooks' => :'Array' } end diff --git a/lib/tremendous/models/member_with_events.rb b/lib/tremendous/models/member_with_events.rb index bb9e296..e62f206 100644 --- a/lib/tremendous/models/member_with_events.rb +++ b/lib/tremendous/models/member_with_events.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # Each organization has one or more users that can access and manage that organization. These users are called members. Members can take actions via the Tremendous web dashboard directly. These actions include adding funding sources to the organization, creating Campaigns, and more. class MemberWithEvents attr_accessor :id @@ -85,7 +84,7 @@ def self.openapi_types :'active' => :'Boolean', :'role' => :'String', :'status' => :'String', - :'events' => :'Array' + :'events' => :'Array' } end @@ -97,6 +96,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MemberBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/member_with_events_all_of_events.rb b/lib/tremendous/models/member_with_events_all_of_events.rb new file mode 100644 index 0000000..43f5fa3 --- /dev/null +++ b/lib/tremendous/models/member_with_events_all_of_events.rb @@ -0,0 +1,260 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class MemberWithEventsAllOfEvents + # Event type + attr_accessor :type + + # Timestamp when the event happened + attr_accessor :date_utc + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'date_utc' => :'date_utc' + } + end + + # 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', + :'date_utc' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'date_utc' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::MemberWithEventsAllOfEvents` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::MemberWithEventsAllOfEvents`. Please check the name 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'] + end + + if attributes.key?(:'date_utc') + self.date_utc = attributes[:'date_utc'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the 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', ["created", "last_login"]) + 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', ["created", "last_login"]) + 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 && + date_utc == o.date_utc + end + + # @see the `==` method + # @param [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, date_utc].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/member_without_events.rb b/lib/tremendous/models/member_without_events.rb index 26e0939..89bc67d 100644 --- a/lib/tremendous/models/member_without_events.rb +++ b/lib/tremendous/models/member_without_events.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # Each organization has one or more users that can access and manage that organization. These users are called members. Members can take actions via the Tremendous web dashboard directly. These actions include adding funding sources to the organization, creating Campaigns, and more. class MemberWithoutEvents attr_accessor :id @@ -103,6 +102,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'MemberBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/order_base.rb b/lib/tremendous/models/order_base.rb index 436edea..f6847ee 100644 --- a/lib/tremendous/models/order_base.rb +++ b/lib/tremendous/models/order_base.rb @@ -16,22 +16,18 @@ module Tremendous # An order wraps around the fulfilment of one or more rewards. class OrderBase - # Tremendous ID of the order attr_accessor :id # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only. attr_accessor :external_id - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # Date the order has been created attr_accessor :created_at - # Execution status of a given order
Status Description
CANCELED The order and all of its rewards were canceled.
CART The order has been created, but hasn't yet been processed.
EXECUTED The order has been executed. Payment has been handled and rewards are being delivered (if applicable).
FAILED The order could not be processed due to an error. E.g. due to insufficient funds in the account.
PENDING APPROVAL The order has been created but needs approval to be executed.
PENDING INTERNAL PAYMENT APPROVAL The order has been created but it is under review and requires approval from our team.
attr_accessor :status - # Name of the channel in which the order was created attr_accessor :channel attr_accessor :payment @@ -87,8 +83,8 @@ def self.openapi_types :'external_id' => :'String', :'campaign_id' => :'String', :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', + :'status' => :'OrderStatus', + :'channel' => :'Channel', :'payment' => :'OrderBasePayment', :'invoice_id' => :'String' } @@ -165,11 +161,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "id", id cannot be nil.') end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) if !@campaign_id.nil? && @campaign_id !~ pattern invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") @@ -191,32 +182,12 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? - return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if @created_at.nil? return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - return false unless status_validator.valid?(@status) - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - # Custom attribute writer method with validation # @param [Object] campaign_id Value to be assigned def campaign_id=(campaign_id) @@ -228,26 +199,6 @@ def campaign_id=(campaign_id) @campaign_id = campaign_id end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - 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] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/order_base_payment.rb b/lib/tremendous/models/order_base_payment.rb index 6390a25..63d7bce 100644 --- a/lib/tremendous/models/order_base_payment.rb +++ b/lib/tremendous/models/order_base_payment.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # Cost breakdown of the order (cost of rewards + fees). Cost and fees are always denominated in USD, independent from the currency of the ordered rewards. Note that this property will only appear for processed orders (`status` is `EXECUTED`). class OrderBasePayment # Total price of the order before fees (in USD) attr_accessor :subtotal @@ -58,6 +57,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'PaymentDetails' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/order_with_link.rb b/lib/tremendous/models/order_with_link.rb index a615a24..fdfa4e7 100644 --- a/lib/tremendous/models/order_with_link.rb +++ b/lib/tremendous/models/order_with_link.rb @@ -14,24 +14,19 @@ require 'time' module Tremendous - # An order wraps around the fulfilment of one or more rewards. class OrderWithLink - # Tremendous ID of the order attr_accessor :id # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only. attr_accessor :external_id - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # Date the order has been created attr_accessor :created_at - # Execution status of a given order
Status Description
CANCELED The order and all of its rewards were canceled.
CART The order has been created, but hasn't yet been processed.
EXECUTED The order has been executed. Payment has been handled and rewards are being delivered (if applicable).
FAILED The order could not be processed due to an error. E.g. due to insufficient funds in the account.
PENDING APPROVAL The order has been created but needs approval to be executed.
PENDING INTERNAL PAYMENT APPROVAL The order has been created but it is under review and requires approval from our team.
attr_accessor :status - # Name of the channel in which the order was created attr_accessor :channel attr_accessor :payment @@ -90,11 +85,11 @@ def self.openapi_types :'external_id' => :'String', :'campaign_id' => :'String', :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', + :'status' => :'OrderStatus', + :'channel' => :'Channel', :'payment' => :'OrderBasePayment', :'invoice_id' => :'String', - :'rewards' => :'Array' + :'rewards' => :'Array' } end @@ -106,6 +101,13 @@ def self.openapi_nullable ]) 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 = {}) @@ -175,11 +177,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "id", id cannot be nil.') end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) if !@campaign_id.nil? && @campaign_id !~ pattern invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") @@ -201,32 +198,12 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? - return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if @created_at.nil? return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - return false unless status_validator.valid?(@status) - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - # Custom attribute writer method with validation # @param [Object] campaign_id Value to be assigned def campaign_id=(campaign_id) @@ -238,26 +215,6 @@ def campaign_id=(campaign_id) @campaign_id = campaign_id end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - 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] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/order_without_link.rb b/lib/tremendous/models/order_without_link.rb index 047e4e7..6f2a745 100644 --- a/lib/tremendous/models/order_without_link.rb +++ b/lib/tremendous/models/order_without_link.rb @@ -14,24 +14,19 @@ require 'time' module Tremendous - # An order wraps around the fulfilment of one or more rewards. class OrderWithoutLink - # Tremendous ID of the order attr_accessor :id # Reference for this order, supplied by the customer. When set, `external_id` makes order idempotent. All requests that use the same `external_id` after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a `201` response code. These responses **fail** to create any further orders. It also allows for retrieving by `external_id` instead of `id` only. attr_accessor :external_id - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # Date the order has been created attr_accessor :created_at - # Execution status of a given order
Status Description
CANCELED The order and all of its rewards were canceled.
CART The order has been created, but hasn't yet been processed.
EXECUTED The order has been executed. Payment has been handled and rewards are being delivered (if applicable).
FAILED The order could not be processed due to an error. E.g. due to insufficient funds in the account.
PENDING APPROVAL The order has been created but needs approval to be executed.
PENDING INTERNAL PAYMENT APPROVAL The order has been created but it is under review and requires approval from our team.
attr_accessor :status - # Name of the channel in which the order was created attr_accessor :channel attr_accessor :payment @@ -90,11 +85,11 @@ def self.openapi_types :'external_id' => :'String', :'campaign_id' => :'String', :'created_at' => :'Time', - :'status' => :'String', - :'channel' => :'String', + :'status' => :'OrderStatus', + :'channel' => :'Channel', :'payment' => :'OrderBasePayment', :'invoice_id' => :'String', - :'rewards' => :'Array' + :'rewards' => :'Array' } end @@ -106,6 +101,13 @@ def self.openapi_nullable ]) 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 = {}) @@ -175,11 +177,6 @@ def list_invalid_properties invalid_properties.push('invalid value for "id", id cannot be nil.') end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - pattern = Regexp.new(/[A-Z0-9]{4,20}/) if !@campaign_id.nil? && @campaign_id !~ pattern invalid_properties.push("invalid value for \"campaign_id\", must conform to the pattern #{pattern}.") @@ -201,32 +198,12 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @id.nil? - return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) return false if @created_at.nil? return false if @status.nil? - status_validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - return false unless status_validator.valid?(@status) - channel_validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - return false unless channel_validator.valid?(@channel) true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - # Custom attribute writer method with validation # @param [Object] campaign_id Value to be assigned def campaign_id=(campaign_id) @@ -238,26 +215,6 @@ def campaign_id=(campaign_id) @campaign_id = campaign_id end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL", "PENDING INTERNAL PAYMENT APPROVAL"]) - 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] channel Object to be assigned - def channel=(channel) - validator = EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) - unless validator.valid?(channel) - fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}." - end - @channel = channel - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/payment_details_refund.rb b/lib/tremendous/models/payment_details_refund.rb index c06a0e8..987847f 100644 --- a/lib/tremendous/models/payment_details_refund.rb +++ b/lib/tremendous/models/payment_details_refund.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # Breakdown of the order refunds (total amount in USD, independent from the currency of the ordered rewards). Note that this property will only appear for canceled orders or orders with canceled rewards. class PaymentDetailsRefund # Total amount of the order refunds (in USD) attr_accessor :total @@ -44,6 +43,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RefundDetails' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/payout.rb b/lib/tremendous/models/payout.rb index 87c77b2..63d921b 100644 --- a/lib/tremendous/models/payout.rb +++ b/lib/tremendous/models/payout.rb @@ -15,12 +15,10 @@ module Tremendous class Payout - # Tremendous ID of the payout attr_accessor :id attr_accessor :status - # Tremendous ID of the paid out product attr_accessor :product_id # Name of the paid out Product @@ -32,6 +30,9 @@ class Payout # Date the payout was executed attr_accessor :executed_at + # Date when a delayed payout will be executed in the future + attr_accessor :defer_execution_until + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -62,7 +63,8 @@ def self.attribute_map :'product_id' => :'product_id', :'product_name' => :'product_name', :'created_at' => :'created_at', - :'executed_at' => :'executed_at' + :'executed_at' => :'executed_at', + :'defer_execution_until' => :'defer_execution_until' } end @@ -79,13 +81,16 @@ def self.openapi_types :'product_id' => :'String', :'product_name' => :'String', :'created_at' => :'Time', - :'executed_at' => :'Time' + :'executed_at' => :'Time', + :'defer_execution_until' => :'Time' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'executed_at', + :'defer_execution_until' ]) end @@ -127,6 +132,10 @@ def initialize(attributes = {}) if attributes.key?(:'executed_at') self.executed_at = attributes[:'executed_at'] end + + if attributes.key?(:'defer_execution_until') + self.defer_execution_until = attributes[:'defer_execution_until'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -208,7 +217,8 @@ def ==(o) product_id == o.product_id && product_name == o.product_name && created_at == o.created_at && - executed_at == o.executed_at + executed_at == o.executed_at && + defer_execution_until == o.defer_execution_until end # @see the `==` method @@ -220,7 +230,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, status, product_id, product_name, created_at, executed_at].hash + [id, status, product_id, product_name, created_at, executed_at, defer_execution_until].hash end # Builds the object from hash diff --git a/lib/tremendous/models/product.rb b/lib/tremendous/models/product.rb index 4b199e4..5c6d53f 100644 --- a/lib/tremendous/models/product.rb +++ b/lib/tremendous/models/product.rb @@ -92,10 +92,10 @@ def self.openapi_types :'description' => :'String', :'category' => :'String', :'disclosure' => :'String', - :'skus' => :'Array', - :'currency_codes' => :'Array', - :'countries' => :'Array', - :'images' => :'Array' + :'skus' => :'Array', + :'currency_codes' => :'Array', + :'countries' => :'Array', + :'images' => :'Array' } end @@ -284,6 +284,20 @@ def category=(category) @category = category end + # Custom attribute writer method with validation + # @param [Object] currency_codes Value to be assigned + def currency_codes=(currency_codes) + if currency_codes.nil? + fail ArgumentError, 'currency_codes cannot be nil' + end + + if currency_codes.length < 1 + fail ArgumentError, 'invalid value for "currency_codes", number of items must be greater than or equal to 1.' + end + + @currency_codes = currency_codes + end + # Custom attribute writer method with validation # @param [Object] countries Value to be assigned def countries=(countries) diff --git a/lib/tremendous/models/product_countries_inner.rb b/lib/tremendous/models/product_countries_inner.rb new file mode 100644 index 0000000..c980e7e --- /dev/null +++ b/lib/tremendous/models/product_countries_inner.rb @@ -0,0 +1,222 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class ProductCountriesInner + # ISO 3166 country code + attr_accessor :abbr + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'abbr' => :'abbr' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'abbr' => :'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 `Tremendous::ProductCountriesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ProductCountriesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'abbr') + self.abbr = attributes[:'abbr'] + else + self.abbr = 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 @abbr.nil? + invalid_properties.push('invalid value for "abbr", abbr 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 @abbr.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 && + abbr == o.abbr + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [abbr].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/product_images_inner.rb b/lib/tremendous/models/product_images_inner.rb new file mode 100644 index 0000000..5ed7af0 --- /dev/null +++ b/lib/tremendous/models/product_images_inner.rb @@ -0,0 +1,273 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class ProductImagesInner + # URL to this image + attr_accessor :src + + # Type of image + 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 + { + :'src' => :'src', + :'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 + { + :'src' => :'String', + :'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 `Tremendous::ProductImagesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ProductImagesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'src') + self.src = attributes[:'src'] + else + self.src = nil + 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 @src.nil? + invalid_properties.push('invalid value for "src", src 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 @src.nil? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('String', ["card", "logo"]) + 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', ["card", "logo"]) + 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 && + src == o.src && + 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 + [src, 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 = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/product_skus_inner.rb b/lib/tremendous/models/product_skus_inner.rb new file mode 100644 index 0000000..6a5220b --- /dev/null +++ b/lib/tremendous/models/product_skus_inner.rb @@ -0,0 +1,277 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class ProductSkusInner + # Minimal denomination that this product supports (in the product's currency) + attr_accessor :min + + # Maximum denomination that this product supports (in the product's currency) + attr_accessor :max + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'min' => :'min', + :'max' => :'max' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'min' => :'Float', + :'max' => :'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 `Tremendous::ProductSkusInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ProductSkusInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'min') + self.min = attributes[:'min'] + else + self.min = nil + end + + if attributes.key?(:'max') + self.max = attributes[:'max'] + else + self.max = 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 @min.nil? + invalid_properties.push('invalid value for "min", min cannot be nil.') + end + + if @min < 0 + invalid_properties.push('invalid value for "min", must be greater than or equal to 0.') + end + + if @max.nil? + invalid_properties.push('invalid value for "max", max cannot be nil.') + end + + if @max < 0 + invalid_properties.push('invalid value for "max", 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' + return false if @min.nil? + return false if @min < 0 + return false if @max.nil? + return false if @max < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] min Value to be assigned + def min=(min) + if min.nil? + fail ArgumentError, 'min cannot be nil' + end + + if min < 0 + fail ArgumentError, 'invalid value for "min", must be greater than or equal to 0.' + end + + @min = min + end + + # Custom attribute writer method with validation + # @param [Object] max Value to be assigned + def max=(max) + if max.nil? + fail ArgumentError, 'max cannot be nil' + end + + if max < 0 + fail ArgumentError, 'invalid value for "max", must be greater than or equal to 0.' + end + + @max = max + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + min == o.min && + max == o.max + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [min, max].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/resend_reward_request.rb b/lib/tremendous/models/resend_reward_request.rb new file mode 100644 index 0000000..673fa28 --- /dev/null +++ b/lib/tremendous/models/resend_reward_request.rb @@ -0,0 +1,225 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + class ResendRewardRequest + # The new email address of the recipient (only for rewards delivered via email) + attr_accessor :updated_email + + # The new phone number of the recipient (only for rewards delivered via SMS) + attr_accessor :updated_phone + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'updated_email' => :'updated_email', + :'updated_phone' => :'updated_phone' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'updated_email' => :'String', + :'updated_phone' => :'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 `Tremendous::ResendRewardRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::ResendRewardRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'updated_email') + self.updated_email = attributes[:'updated_email'] + end + + if attributes.key?(:'updated_phone') + self.updated_phone = attributes[:'updated_phone'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + updated_email == o.updated_email && + updated_phone == o.updated_phone + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [updated_email, updated_phone].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/reward_base.rb b/lib/tremendous/models/reward_base.rb index e97484a..cbd8d17 100644 --- a/lib/tremendous/models/reward_base.rb +++ b/lib/tremendous/models/reward_base.rb @@ -16,16 +16,13 @@ module Tremendous # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. class RewardBase - # Tremendous ID of the reward attr_accessor :id - # Tremendous ID of the order this reward is part of. attr_accessor :order_id # Date the reward was created attr_accessor :created_at - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel. @@ -68,10 +65,10 @@ def self.openapi_types :'created_at' => :'Time', :'campaign_id' => :'String', :'products' => :'Array', - :'value' => :'ListRewards200ResponseRewardsInnerValue', - :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'value' => :'RewardValue', + :'recipient' => :'Recipient', :'deliver_at' => :'Date', - :'custom_fields' => :'Array' + :'custom_fields' => :'Array' } end diff --git a/lib/tremendous/models/reward_for_order_create.rb b/lib/tremendous/models/reward_for_order_create.rb index aad0e09..e3aa892 100644 --- a/lib/tremendous/models/reward_for_order_create.rb +++ b/lib/tremendous/models/reward_for_order_create.rb @@ -14,18 +14,14 @@ require 'time' module Tremendous - # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. class RewardForOrderCreate - # Tremendous ID of the reward attr_accessor :id - # Tremendous ID of the order this reward is part of. attr_accessor :order_id # Date the reward was created attr_accessor :created_at - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel. @@ -75,12 +71,12 @@ def self.openapi_types :'created_at' => :'Time', :'campaign_id' => :'String', :'products' => :'Array', - :'value' => :'ListRewards200ResponseRewardsInnerValue', - :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'value' => :'RewardValue', + :'recipient' => :'Recipient', :'deliver_at' => :'Date', - :'custom_fields' => :'Array', + :'custom_fields' => :'Array', :'language' => :'String', - :'delivery' => :'SingleRewardOrderRewardDelivery' + :'delivery' => :'RewardForOrderCreateAllOfDelivery' } end @@ -91,6 +87,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RewardBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/reward_for_order_create_all_of_delivery.rb b/lib/tremendous/models/reward_for_order_create_all_of_delivery.rb new file mode 100644 index 0000000..34f9db8 --- /dev/null +++ b/lib/tremendous/models/reward_for_order_create_all_of_delivery.rb @@ -0,0 +1,237 @@ +=begin +#API Endpoints + +#Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API. + +The version of the OpenAPI document: 2 +Contact: developers@tremendous.com +Generated by: https://openapi-generator.tech +Generator version: 7.8.0 + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class RewardForOrderCreateAllOfDelivery + attr_accessor :method + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'method' => :'method' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'method' => :'DeliveryMethod' + } + 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 `Tremendous::RewardForOrderCreateAllOfDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::RewardForOrderCreateAllOfDelivery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'method') + self.method = attributes[:'method'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + method == o.method + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [method].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/tremendous/models/reward_link.rb b/lib/tremendous/models/reward_link.rb index 75b6b8f..9a207e9 100644 --- a/lib/tremendous/models/reward_link.rb +++ b/lib/tremendous/models/reward_link.rb @@ -16,7 +16,6 @@ module Tremendous # The redemption link for a reward. class RewardLink - # Tremendous ID of the reward attr_accessor :id # Link to redeem the reward at. You need to deliver this link to the recipient. @@ -78,11 +77,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@id.nil? && @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - invalid_properties end @@ -90,25 +84,9 @@ 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? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/reward_token.rb b/lib/tremendous/models/reward_token.rb index 791be39..f35c8bd 100644 --- a/lib/tremendous/models/reward_token.rb +++ b/lib/tremendous/models/reward_token.rb @@ -16,7 +16,6 @@ module Tremendous # The redemption token for a reward. class RewardToken - # Tremendous ID of the reward attr_accessor :id # The token to redeem the reward. @@ -87,11 +86,6 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if !@id.nil? && @id !~ pattern - invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.") - end - invalid_properties end @@ -99,25 +93,9 @@ 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? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) true end - # Custom attribute writer method with validation - # @param [Object] id Value to be assigned - def id=(id) - if id.nil? - fail ArgumentError, 'id cannot be nil' - end - - pattern = Regexp.new(/[A-Z0-9]{4,20}/) - if id !~ pattern - fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}." - end - - @id = id - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/reward_value.rb b/lib/tremendous/models/reward_value.rb index 75f3a39..2a77e7b 100644 --- a/lib/tremendous/models/reward_value.rb +++ b/lib/tremendous/models/reward_value.rb @@ -18,31 +18,8 @@ class RewardValue # Amount of the reward attr_accessor :denomination - # Currency of the reward attr_accessor :currency_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 { @@ -60,7 +37,7 @@ def self.acceptable_attributes def self.openapi_types { :'denomination' => :'Float', - :'currency_code' => :'String' + :'currency_code' => :'CurrencyCodes' } end @@ -93,8 +70,6 @@ def initialize(attributes = {}) if attributes.key?(:'currency_code') self.currency_code = attributes[:'currency_code'] - else - self.currency_code = 'USD' end end @@ -115,21 +90,9 @@ def list_invalid_properties def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @denomination.nil? - currency_code_validator = EnumAttributeValidator.new('String', ["USD", "CAD", "EUR", "AED", "AFN", "ALL", "AMD", "ARS", "AUD", "AZN", "BAM", "BDT", "BGN", "BHD", "BIF", "BND", "BOB", "BRL", "BWP", "BYR", "BZD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EEK", "EGP", "ERN", "ETB", "GBP", "GEL", "GHS", "GNF", "GTQ", "HKD", "HNL", "HRK", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KHR", "KRW", "KWD", "KZT", "LBP", "LKR", "LTL", "LVL", "MAD", "MDL", "MGA", "MKD", "MMK", "MOP", "MUR", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SDG", "SEK", "SGD", "SOS", "SYP", "THB", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "UYU", "UZS", "VEF", "VND", "XAF", "XOF", "YER", "ZAR", "ZMK"]) - return false unless currency_code_validator.valid?(@currency_code) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] currency_code Object to be assigned - def currency_code=(currency_code) - validator = EnumAttributeValidator.new('String', ["USD", "CAD", "EUR", "AED", "AFN", "ALL", "AMD", "ARS", "AUD", "AZN", "BAM", "BDT", "BGN", "BHD", "BIF", "BND", "BOB", "BRL", "BWP", "BYR", "BZD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EEK", "EGP", "ERN", "ETB", "GBP", "GEL", "GHS", "GNF", "GTQ", "HKD", "HNL", "HRK", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KHR", "KRW", "KWD", "KZT", "LBP", "LKR", "LTL", "LVL", "MAD", "MDL", "MGA", "MKD", "MMK", "MOP", "MUR", "MXN", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SDG", "SEK", "SGD", "SOS", "SYP", "THB", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "UYU", "UZS", "VEF", "VND", "XAF", "XOF", "YER", "ZAR", "ZMK"]) - unless validator.valid?(currency_code) - fail ArgumentError, "invalid value for \"currency_code\", must be one of #{validator.allowable_values}." - end - @currency_code = currency_code - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) diff --git a/lib/tremendous/models/reward_with_link.rb b/lib/tremendous/models/reward_with_link.rb index 068b07d..2dc645c 100644 --- a/lib/tremendous/models/reward_with_link.rb +++ b/lib/tremendous/models/reward_with_link.rb @@ -14,18 +14,14 @@ require 'time' module Tremendous - # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. class RewardWithLink - # Tremendous ID of the reward attr_accessor :id - # Tremendous ID of the order this reward is part of. attr_accessor :order_id # Date the reward was created attr_accessor :created_at - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel. @@ -71,11 +67,11 @@ def self.openapi_types :'created_at' => :'Time', :'campaign_id' => :'String', :'products' => :'Array', - :'value' => :'ListRewards200ResponseRewardsInnerValue', - :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'value' => :'RewardValue', + :'recipient' => :'Recipient', :'deliver_at' => :'Date', - :'custom_fields' => :'Array', - :'delivery' => :'RewardWithLinkDelivery' + :'custom_fields' => :'Array', + :'delivery' => :'DeliveryDetailsWithLink' } end @@ -86,6 +82,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RewardBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/reward_without_link.rb b/lib/tremendous/models/reward_without_link.rb index 7c5d996..9b28faa 100644 --- a/lib/tremendous/models/reward_without_link.rb +++ b/lib/tremendous/models/reward_without_link.rb @@ -14,18 +14,14 @@ require 'time' module Tremendous - # A single reward, sent to a recipient. A reward is always part of an order. Either `products` or `campaign_id` must be specified. class RewardWithoutLink - # Tremendous ID of the reward attr_accessor :id - # Tremendous ID of the order this reward is part of. attr_accessor :order_id # Date the reward was created attr_accessor :created_at - # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from. attr_accessor :campaign_id # List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from. Providing a `products` array will override the products made available by the campaign specified using the `campaign_id` property unless the `products` array is empty. It will _not_ override other campaign attributes, like the message and customization of the look and feel. @@ -71,11 +67,11 @@ def self.openapi_types :'created_at' => :'Time', :'campaign_id' => :'String', :'products' => :'Array', - :'value' => :'ListRewards200ResponseRewardsInnerValue', - :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'value' => :'RewardValue', + :'recipient' => :'Recipient', :'deliver_at' => :'Date', - :'custom_fields' => :'Array', - :'delivery' => :'RewardWithoutLinkDelivery' + :'custom_fields' => :'Array', + :'delivery' => :'DeliveryDetails' } end @@ -86,6 +82,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'RewardBase' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) diff --git a/lib/tremendous/models/single_reward_order.rb b/lib/tremendous/models/single_reward_order.rb index 98128a2..19cae2c 100644 --- a/lib/tremendous/models/single_reward_order.rb +++ b/lib/tremendous/models/single_reward_order.rb @@ -41,8 +41,8 @@ def self.acceptable_attributes def self.openapi_types { :'external_id' => :'String', - :'payment' => :'SingleRewardOrderPayment', - :'reward' => :'SingleRewardOrderReward' + :'payment' => :'BaseOrderForCreatePayment', + :'reward' => :'Object' } end @@ -53,6 +53,13 @@ def self.openapi_nullable ]) end + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'BaseOrderForCreate' + ] + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) @@ -74,6 +81,8 @@ def initialize(attributes = {}) if attributes.key?(:'payment') self.payment = attributes[:'payment'] + else + self.payment = nil end if attributes.key?(:'reward') @@ -88,6 +97,10 @@ def initialize(attributes = {}) def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if @payment.nil? + invalid_properties.push('invalid value for "payment", payment cannot be nil.') + end + if @reward.nil? invalid_properties.push('invalid value for "reward", reward cannot be nil.') end @@ -99,6 +112,7 @@ def list_invalid_properties # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @payment.nil? return false if @reward.nil? true end diff --git a/lib/tremendous/models/single_reward_order_with_link.rb b/lib/tremendous/models/single_reward_order_with_link.rb index 839d065..17de8f3 100644 --- a/lib/tremendous/models/single_reward_order_with_link.rb +++ b/lib/tremendous/models/single_reward_order_with_link.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'order' => :'SingleRewardOrderWithLinkOrder' + :'order' => :'OrderWithLink' } end diff --git a/lib/tremendous/models/single_reward_order_without_link.rb b/lib/tremendous/models/single_reward_order_without_link.rb index 01eaf40..438fee6 100644 --- a/lib/tremendous/models/single_reward_order_without_link.rb +++ b/lib/tremendous/models/single_reward_order_without_link.rb @@ -32,7 +32,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'order' => :'SingleRewardOrderWithoutLinkOrder' + :'order' => :'OrderWithoutLink' } end diff --git a/lib/tremendous/models/update_campaign.rb b/lib/tremendous/models/update_campaign.rb index 22d543b..bb28404 100644 --- a/lib/tremendous/models/update_campaign.rb +++ b/lib/tremendous/models/update_campaign.rb @@ -14,7 +14,6 @@ require 'time' module Tremendous - # With a campaign you can define the look & feel of how rewards are sent out. It also lets you set the available products (different gift cards, charity, etc.) recipients can choose from. class UpdateCampaign attr_accessor :id @@ -55,8 +54,8 @@ def self.openapi_types :'name' => :'String', :'description' => :'String', :'products' => :'Array', - :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle', - :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle' + :'webpage_style' => :'CampaignBaseWebpageStyle', + :'email_style' => :'CampaignBaseEmailStyle' } end @@ -67,6 +66,13 @@ def self.openapi_nullable ]) 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 = {}) diff --git a/lib/tremendous/models/update_fraud_rule_list_request_config.rb b/lib/tremendous/models/update_fraud_rule_list_request_config.rb index 4de57d2..262ad4d 100644 --- a/lib/tremendous/models/update_fraud_rule_list_request_config.rb +++ b/lib/tremendous/models/update_fraud_rule_list_request_config.rb @@ -20,11 +20,10 @@ class << self # List of class defined in anyOf (OpenAPI v3) def openapi_any_of [ - :'AllowEmail1', - :'AllowIp1', - :'ReviewCountry1', - :'ReviewEmail1', - :'ReviewIp1' + :'FraudConfigAllowEmail', + :'FraudConfigCountryUpdateList', + :'FraudConfigIP', + :'FraudConfigReviewEmail' ] end