From fb0bdfce98c00ef022eecf34848ab66b1bf81c95 Mon Sep 17 00:00:00 2001 From: Lucas Mazza Date: Wed, 6 Mar 2024 17:32:46 -0300 Subject: [PATCH] initial commit --- .github/CODEOWNERS | 1 + .github/dependabot.yml | 11 + .github/workflows/check-updates.yml | 20 + .github/workflows/publish.yml | 20 + .github/workflows/test.yml | 34 ++ .gitignore | 39 ++ .openapi-generator-ignore | 31 ++ .openapi-generator/FILES | 268 ++++++++++ .openapi-generator/VERSION | 1 + Gemfile | 6 + Gemfile.lock | 47 ++ README.md | 261 ++++++++++ Rakefile | 11 + bin/check-updates | 19 + bin/download-spec | 9 + bin/generate | 18 + lib/tremendous.rb | 169 +++++++ .../api/balance_transactions_api.rb | 91 ++++ lib/tremendous/api/campaigns_api.rb | 147 ++++++ lib/tremendous/api/fields_api.rb | 79 +++ lib/tremendous/api/funding_sources_api.rb | 147 ++++++ lib/tremendous/api/invoices_api.rb | 405 ++++++++++++++++ lib/tremendous/api/members_api.rb | 213 ++++++++ lib/tremendous/api/orders_api.rb | 369 ++++++++++++++ lib/tremendous/api/organizations_api.rb | 270 +++++++++++ lib/tremendous/api/products_api.rb | 153 ++++++ lib/tremendous/api/rewards_api.rb | 354 ++++++++++++++ lib/tremendous/api/webhooks_api.rb | 362 ++++++++++++++ lib/tremendous/api_client.rb | 431 +++++++++++++++++ lib/tremendous/api_error.rb | 58 +++ lib/tremendous/configuration.rb | 386 +++++++++++++++ lib/tremendous/models/balance_transaction.rb | 256 ++++++++++ lib/tremendous/models/campaign.rb | 292 +++++++++++ .../models/create_api_key200_response.rb | 215 ++++++++ lib/tremendous/models/create_invoice.rb | 244 ++++++++++ .../models/create_invoice200_response.rb | 221 +++++++++ .../models/create_invoice_request.rb | 244 ++++++++++ lib/tremendous/models/create_member.rb | 290 +++++++++++ .../models/create_member200_response.rb | 221 +++++++++ .../models/create_member_request.rb | 290 +++++++++++ .../models/create_order200_response.rb | 221 +++++++++ .../models/create_order200_response_order.rb | 400 +++++++++++++++ ...e_order200_response_order_rewards_inner.rb | 347 +++++++++++++ ...0_response_order_rewards_inner_delivery.rb | 296 ++++++++++++ .../models/create_order201_response.rb | 221 +++++++++ lib/tremendous/models/create_order_request.rb | 248 ++++++++++ .../models/create_order_request_payment.rb | 222 +++++++++ .../models/create_order_request_reward.rb | 344 +++++++++++++ .../create_order_request_reward_delivery.rb | 250 ++++++++++ lib/tremendous/models/create_organization.rb | 268 ++++++++++ .../models/create_organization200_response.rb | 214 ++++++++ ...e_organization200_response_organization.rb | 334 +++++++++++++ .../models/create_organization_request.rb | 268 ++++++++++ ...eate_organization_request_copy_settings.rb | 278 +++++++++++ .../models/create_webhook200_response.rb | 214 ++++++++ .../models/create_webhook_request.rb | 222 +++++++++ lib/tremendous/models/currency_codes.rb | 154 ++++++ lib/tremendous/models/custom_field.rb | 248 ++++++++++ lib/tremendous/models/delivery_details.rb | 286 +++++++++++ .../models/delivery_details_with_link.rb | 296 ++++++++++++ lib/tremendous/models/delivery_method.rb | 41 ++ lib/tremendous/models/delivery_status.rb | 42 ++ lib/tremendous/models/error_model.rb | 221 +++++++++ lib/tremendous/models/field.rb | 286 +++++++++++ lib/tremendous/models/funding_source.rb | 332 +++++++++++++ .../generate_reward_link200_response.rb | 221 +++++++++ ...generate_reward_link200_response_reward.rb | 247 ++++++++++ .../generate_reward_link403_response.rb | 221 +++++++++ .../generate_reward_token200_response.rb | 221 +++++++++ ...enerate_reward_token200_response_reward.rb | 257 ++++++++++ .../models/get_campaign200_response.rb | 221 +++++++++ .../models/get_funding_source200_response.rb | 221 +++++++++ .../models/get_member200_response.rb | 221 +++++++++ .../models/get_member200_response_member.rb | 365 ++++++++++++++ ..._member200_response_member_events_inner.rb | 260 ++++++++++ .../models/get_organization200_response.rb | 214 ++++++++ .../models/get_product200_response.rb | 221 +++++++++ .../models/get_reward200_response.rb | 221 +++++++++ lib/tremendous/models/invoice.rb | 356 ++++++++++++++ .../list_balance_transactions200_response.rb | 216 +++++++++ ...transactions200_response_invoices_inner.rb | 256 ++++++++++ .../models/list_campaigns200_response.rb | 223 +++++++++ ...t_campaigns200_response_campaigns_inner.rb | 292 +++++++++++ .../models/list_fields200_response.rb | 216 +++++++++ .../list_fields200_response_fields_inner.rb | 286 +++++++++++ .../list_funding_sources200_response.rb | 223 +++++++++ ...urces200_response_funding_sources_inner.rb | 332 +++++++++++++ ...200_response_funding_sources_inner_meta.rb | 435 +++++++++++++++++ .../models/list_invoices200_response.rb | 240 +++++++++ ...ist_invoices200_response_invoices_inner.rb | 356 ++++++++++++++ .../models/list_members200_response.rb | 223 +++++++++ .../list_members200_response_members_inner.rb | 374 ++++++++++++++ .../models/list_orders200_response.rb | 240 +++++++++ .../list_orders200_response_orders_inner.rb | 379 +++++++++++++++ ...orders200_response_orders_inner_payment.rb | 346 +++++++++++++ ...00_response_orders_inner_payment_refund.rb | 242 ++++++++++ .../models/list_organizations200_response.rb | 216 +++++++++ ...zations200_response_organizations_inner.rb | 324 +++++++++++++ .../models/list_products200_response.rb | 223 +++++++++ ...ist_products200_response_products_inner.rb | 457 ++++++++++++++++++ ...response_products_inner_countries_inner.rb | 222 +++++++++ ...00_response_products_inner_images_inner.rb | 273 +++++++++++ ...s200_response_products_inner_skus_inner.rb | 277 +++++++++++ .../models/list_rewards200_response.rb | 226 +++++++++ .../list_rewards200_response_rewards_inner.rb | 347 +++++++++++++ ...ponse_rewards_inner_custom_fields_inner.rb | 248 ++++++++++ ...ards200_response_rewards_inner_delivery.rb | 286 +++++++++++ ...rds200_response_rewards_inner_recipient.rb | 236 +++++++++ ...rewards200_response_rewards_inner_value.rb | 273 +++++++++++ .../models/list_rewards401_response.rb | 221 +++++++++ .../models/list_rewards401_response_errors.rb | 225 +++++++++ .../models/list_rewards429_response.rb | 221 +++++++++ .../models/list_webhook_events200_response.rb | 216 +++++++++ .../models/list_webhooks200_response.rb | 216 +++++++++ ...ist_webhooks200_response_webhooks_inner.rb | 262 ++++++++++ lib/tremendous/models/member.rb | 374 ++++++++++++++ lib/tremendous/models/member_base.rb | 353 ++++++++++++++ lib/tremendous/models/member_with_events.rb | 365 ++++++++++++++ .../models/member_without_events.rb | 374 ++++++++++++++ lib/tremendous/models/order.rb | 379 +++++++++++++++ lib/tremendous/models/order_base.rb | 370 ++++++++++++++ lib/tremendous/models/order_base_payment.rb | 346 +++++++++++++ lib/tremendous/models/order_for_create.rb | 248 ++++++++++ .../models/order_for_create_reward.rb | 416 ++++++++++++++++ lib/tremendous/models/order_status.rb | 43 ++ lib/tremendous/models/order_with_link.rb | 400 +++++++++++++++ .../models/order_with_link_rewards_inner.rb | 406 ++++++++++++++++ lib/tremendous/models/order_without_link.rb | 379 +++++++++++++++ .../models/order_without_link_reward.rb | 406 ++++++++++++++++ lib/tremendous/models/organization.rb | 324 +++++++++++++ lib/tremendous/models/payment_details.rb | 345 +++++++++++++ .../models/payment_details_refund.rb | 242 ++++++++++ lib/tremendous/models/product.rb | 457 ++++++++++++++++++ lib/tremendous/models/recipient.rb | 236 +++++++++ lib/tremendous/models/refund_details.rb | 241 +++++++++ .../models/resend_reward422_response.rb | 221 +++++++++ lib/tremendous/models/reward.rb | 406 ++++++++++++++++ lib/tremendous/models/reward_base.rb | 397 +++++++++++++++ .../models/reward_base_custom_fields_inner.rb | 248 ++++++++++ .../models/reward_for_order_create.rb | 416 ++++++++++++++++ lib/tremendous/models/reward_link.rb | 247 ++++++++++ lib/tremendous/models/reward_token.rb | 257 ++++++++++ lib/tremendous/models/reward_value.rb | 273 +++++++++++ lib/tremendous/models/reward_with_link.rb | 406 ++++++++++++++++ .../models/reward_with_link_delivery.rb | 296 ++++++++++++ lib/tremendous/models/reward_without_link.rb | 406 ++++++++++++++++ .../models/reward_without_link_delivery.rb | 286 +++++++++++ .../models/simulate_webhook_request.rb | 222 +++++++++ lib/tremendous/models/webhook.rb | 262 ++++++++++ lib/tremendous/models/webhook_post.rb | 222 +++++++++ lib/tremendous/version.rb | 3 + spec/api/balance_transactions_api_spec.rb | 50 ++ spec/api/campaigns_api_spec.rb | 58 +++ spec/api/fields_api_spec.rb | 46 ++ spec/api/funding_sources_api_spec.rb | 58 +++ spec/api/invoices_api_spec.rb | 108 +++++ spec/api/members_api_spec.rb | 69 +++ spec/api/orders_api_spec.rb | 100 ++++ spec/api/organizations_api_spec.rb | 80 +++ spec/api/products_api_spec.rb | 60 +++ spec/api/rewards_api_spec.rb | 95 ++++ spec/api/webhooks_api_spec.rb | 95 ++++ spec/models/balance_transaction_spec.rb | 60 +++ spec/models/campaign_spec.rb | 54 +++ .../models/create_api_key200_response_spec.rb | 36 ++ .../models/create_invoice200_response_spec.rb | 36 ++ spec/models/create_invoice_request_spec.rb | 48 ++ spec/models/create_invoice_spec.rb | 48 ++ spec/models/create_member200_response_spec.rb | 36 ++ spec/models/create_member_request_spec.rb | 52 ++ spec/models/create_member_spec.rb | 52 ++ ...ponse_order_rewards_inner_delivery_spec.rb | 56 +++ ...er200_response_order_rewards_inner_spec.rb | 78 +++ .../create_order200_response_order_spec.rb | 82 ++++ spec/models/create_order200_response_spec.rb | 36 ++ spec/models/create_order201_response_spec.rb | 36 ++ .../create_order_request_payment_spec.rb | 36 ++ ...eate_order_request_reward_delivery_spec.rb | 40 ++ .../create_order_request_reward_spec.rb | 78 +++ spec/models/create_order_request_spec.rb | 48 ++ ...anization200_response_organization_spec.rb | 70 +++ .../create_organization200_response_spec.rb | 36 ++ ...organization_request_copy_settings_spec.rb | 66 +++ .../create_organization_request_spec.rb | 60 +++ spec/models/create_organization_spec.rb | 60 +++ .../models/create_webhook200_response_spec.rb | 36 ++ spec/models/create_webhook_request_spec.rb | 36 ++ spec/models/currency_codes_spec.rb | 30 ++ spec/models/custom_field_spec.rb | 42 ++ spec/models/delivery_details_spec.rb | 50 ++ .../models/delivery_details_with_link_spec.rb | 56 +++ spec/models/delivery_method_spec.rb | 30 ++ spec/models/delivery_status_spec.rb | 30 ++ spec/models/error_model_spec.rb | 36 ++ spec/models/field_spec.rb | 66 +++ spec/models/funding_source_spec.rb | 62 +++ ...ate_reward_link200_response_reward_spec.rb | 42 ++ .../generate_reward_link200_response_spec.rb | 36 ++ .../generate_reward_link403_response_spec.rb | 36 ++ ...te_reward_token200_response_reward_spec.rb | 48 ++ .../generate_reward_token200_response_spec.rb | 36 ++ spec/models/get_campaign200_response_spec.rb | 36 ++ .../get_funding_source200_response_spec.rb | 36 ++ ...er200_response_member_events_inner_spec.rb | 46 ++ .../get_member200_response_member_spec.rb | 74 +++ spec/models/get_member200_response_spec.rb | 36 ++ .../get_organization200_response_spec.rb | 36 ++ spec/models/get_product200_response_spec.rb | 36 ++ spec/models/get_reward200_response_spec.rb | 36 ++ spec/models/invoice_spec.rb | 82 ++++ ...actions200_response_invoices_inner_spec.rb | 60 +++ ...t_balance_transactions200_response_spec.rb | 36 ++ ...paigns200_response_campaigns_inner_spec.rb | 54 +++ .../models/list_campaigns200_response_spec.rb | 36 ++ ...st_fields200_response_fields_inner_spec.rb | 66 +++ spec/models/list_fields200_response_spec.rb | 36 ++ ...esponse_funding_sources_inner_meta_spec.rb | 110 +++++ ...200_response_funding_sources_inner_spec.rb | 62 +++ .../list_funding_sources200_response_spec.rb | 36 ++ ...nvoices200_response_invoices_inner_spec.rb | 82 ++++ spec/models/list_invoices200_response_spec.rb | 42 ++ ..._members200_response_members_inner_spec.rb | 80 +++ spec/models/list_members200_response_spec.rb | 36 ++ ...sponse_orders_inner_payment_refund_spec.rb | 36 ++ ...s200_response_orders_inner_payment_spec.rb | 64 +++ ...st_orders200_response_orders_inner_spec.rb | 82 ++++ spec/models/list_orders200_response_spec.rb | 42 ++ ...ns200_response_organizations_inner_spec.rb | 64 +++ .../list_organizations200_response_spec.rb | 36 ++ ...nse_products_inner_countries_inner_spec.rb | 36 ++ ...sponse_products_inner_images_inner_spec.rb | 46 ++ ...response_products_inner_skus_inner_spec.rb | 42 ++ ...roducts200_response_products_inner_spec.rb | 92 ++++ spec/models/list_products200_response_spec.rb | 36 ++ ..._rewards_inner_custom_fields_inner_spec.rb | 42 ++ ...00_response_rewards_inner_delivery_spec.rb | 50 ++ ...0_response_rewards_inner_recipient_spec.rb | 48 ++ ..._rewards200_response_rewards_inner_spec.rb | 78 +++ ...ds200_response_rewards_inner_value_spec.rb | 46 ++ spec/models/list_rewards200_response_spec.rb | 42 ++ .../list_rewards401_response_errors_spec.rb | 42 ++ spec/models/list_rewards401_response_spec.rb | 36 ++ spec/models/list_rewards429_response_spec.rb | 36 ++ .../list_webhook_events200_response_spec.rb | 36 ++ spec/models/list_webhooks200_response_spec.rb | 36 ++ ...ebhooks200_response_webhooks_inner_spec.rb | 48 ++ spec/models/member_base_spec.rb | 68 +++ spec/models/member_spec.rb | 80 +++ spec/models/member_with_events_spec.rb | 74 +++ spec/models/member_without_events_spec.rb | 80 +++ spec/models/order_base_payment_spec.rb | 64 +++ spec/models/order_base_spec.rb | 76 +++ spec/models/order_for_create_reward_spec.rb | 96 ++++ spec/models/order_for_create_spec.rb | 48 ++ spec/models/order_spec.rb | 82 ++++ spec/models/order_status_spec.rb | 30 ++ .../order_with_link_rewards_inner_spec.rb | 90 ++++ spec/models/order_with_link_spec.rb | 82 ++++ spec/models/order_without_link_reward_spec.rb | 90 ++++ spec/models/order_without_link_spec.rb | 82 ++++ spec/models/organization_spec.rb | 64 +++ spec/models/payment_details_refund_spec.rb | 36 ++ spec/models/payment_details_spec.rb | 64 +++ spec/models/product_spec.rb | 92 ++++ spec/models/recipient_spec.rb | 48 ++ spec/models/refund_details_spec.rb | 36 ++ spec/models/resend_reward422_response_spec.rb | 36 ++ .../reward_base_custom_fields_inner_spec.rb | 42 ++ spec/models/reward_base_spec.rb | 84 ++++ spec/models/reward_for_order_create_spec.rb | 96 ++++ spec/models/reward_link_spec.rb | 42 ++ spec/models/reward_spec.rb | 90 ++++ spec/models/reward_token_spec.rb | 48 ++ spec/models/reward_value_spec.rb | 46 ++ spec/models/reward_with_link_delivery_spec.rb | 56 +++ spec/models/reward_with_link_spec.rb | 90 ++++ .../reward_without_link_delivery_spec.rb | 50 ++ spec/models/reward_without_link_spec.rb | 90 ++++ spec/models/simulate_webhook_request_spec.rb | 36 ++ spec/models/webhook_post_spec.rb | 36 ++ spec/models/webhook_spec.rb | 48 ++ spec/spec_helper.rb | 111 +++++ tremendous.gemspec | 25 + 283 files changed, 44916 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/check-updates.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 README.md create mode 100644 Rakefile create mode 100755 bin/check-updates create mode 100755 bin/download-spec create mode 100755 bin/generate create mode 100644 lib/tremendous.rb create mode 100644 lib/tremendous/api/balance_transactions_api.rb create mode 100644 lib/tremendous/api/campaigns_api.rb create mode 100644 lib/tremendous/api/fields_api.rb create mode 100644 lib/tremendous/api/funding_sources_api.rb create mode 100644 lib/tremendous/api/invoices_api.rb create mode 100644 lib/tremendous/api/members_api.rb create mode 100644 lib/tremendous/api/orders_api.rb create mode 100644 lib/tremendous/api/organizations_api.rb create mode 100644 lib/tremendous/api/products_api.rb create mode 100644 lib/tremendous/api/rewards_api.rb create mode 100644 lib/tremendous/api/webhooks_api.rb create mode 100644 lib/tremendous/api_client.rb create mode 100644 lib/tremendous/api_error.rb create mode 100644 lib/tremendous/configuration.rb create mode 100644 lib/tremendous/models/balance_transaction.rb create mode 100644 lib/tremendous/models/campaign.rb create mode 100644 lib/tremendous/models/create_api_key200_response.rb create mode 100644 lib/tremendous/models/create_invoice.rb create mode 100644 lib/tremendous/models/create_invoice200_response.rb create mode 100644 lib/tremendous/models/create_invoice_request.rb create mode 100644 lib/tremendous/models/create_member.rb create mode 100644 lib/tremendous/models/create_member200_response.rb create mode 100644 lib/tremendous/models/create_member_request.rb create mode 100644 lib/tremendous/models/create_order200_response.rb create mode 100644 lib/tremendous/models/create_order200_response_order.rb create mode 100644 lib/tremendous/models/create_order200_response_order_rewards_inner.rb create mode 100644 lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb create mode 100644 lib/tremendous/models/create_order201_response.rb create mode 100644 lib/tremendous/models/create_order_request.rb create mode 100644 lib/tremendous/models/create_order_request_payment.rb create mode 100644 lib/tremendous/models/create_order_request_reward.rb create mode 100644 lib/tremendous/models/create_order_request_reward_delivery.rb create mode 100644 lib/tremendous/models/create_organization.rb create mode 100644 lib/tremendous/models/create_organization200_response.rb create mode 100644 lib/tremendous/models/create_organization200_response_organization.rb create mode 100644 lib/tremendous/models/create_organization_request.rb create mode 100644 lib/tremendous/models/create_organization_request_copy_settings.rb create mode 100644 lib/tremendous/models/create_webhook200_response.rb create mode 100644 lib/tremendous/models/create_webhook_request.rb create mode 100644 lib/tremendous/models/currency_codes.rb create mode 100644 lib/tremendous/models/custom_field.rb create mode 100644 lib/tremendous/models/delivery_details.rb create mode 100644 lib/tremendous/models/delivery_details_with_link.rb create mode 100644 lib/tremendous/models/delivery_method.rb create mode 100644 lib/tremendous/models/delivery_status.rb create mode 100644 lib/tremendous/models/error_model.rb create mode 100644 lib/tremendous/models/field.rb create mode 100644 lib/tremendous/models/funding_source.rb create mode 100644 lib/tremendous/models/generate_reward_link200_response.rb create mode 100644 lib/tremendous/models/generate_reward_link200_response_reward.rb create mode 100644 lib/tremendous/models/generate_reward_link403_response.rb create mode 100644 lib/tremendous/models/generate_reward_token200_response.rb create mode 100644 lib/tremendous/models/generate_reward_token200_response_reward.rb create mode 100644 lib/tremendous/models/get_campaign200_response.rb create mode 100644 lib/tremendous/models/get_funding_source200_response.rb create mode 100644 lib/tremendous/models/get_member200_response.rb create mode 100644 lib/tremendous/models/get_member200_response_member.rb create mode 100644 lib/tremendous/models/get_member200_response_member_events_inner.rb create mode 100644 lib/tremendous/models/get_organization200_response.rb create mode 100644 lib/tremendous/models/get_product200_response.rb create mode 100644 lib/tremendous/models/get_reward200_response.rb create mode 100644 lib/tremendous/models/invoice.rb create mode 100644 lib/tremendous/models/list_balance_transactions200_response.rb create mode 100644 lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb create mode 100644 lib/tremendous/models/list_campaigns200_response.rb create mode 100644 lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb create mode 100644 lib/tremendous/models/list_fields200_response.rb create mode 100644 lib/tremendous/models/list_fields200_response_fields_inner.rb create mode 100644 lib/tremendous/models/list_funding_sources200_response.rb create mode 100644 lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb create mode 100644 lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb create mode 100644 lib/tremendous/models/list_invoices200_response.rb create mode 100644 lib/tremendous/models/list_invoices200_response_invoices_inner.rb create mode 100644 lib/tremendous/models/list_members200_response.rb create mode 100644 lib/tremendous/models/list_members200_response_members_inner.rb create mode 100644 lib/tremendous/models/list_orders200_response.rb create mode 100644 lib/tremendous/models/list_orders200_response_orders_inner.rb create mode 100644 lib/tremendous/models/list_orders200_response_orders_inner_payment.rb create mode 100644 lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb create mode 100644 lib/tremendous/models/list_organizations200_response.rb create mode 100644 lib/tremendous/models/list_organizations200_response_organizations_inner.rb create mode 100644 lib/tremendous/models/list_products200_response.rb create mode 100644 lib/tremendous/models/list_products200_response_products_inner.rb create mode 100644 lib/tremendous/models/list_products200_response_products_inner_countries_inner.rb create mode 100644 lib/tremendous/models/list_products200_response_products_inner_images_inner.rb create mode 100644 lib/tremendous/models/list_products200_response_products_inner_skus_inner.rb create mode 100644 lib/tremendous/models/list_rewards200_response.rb create mode 100644 lib/tremendous/models/list_rewards200_response_rewards_inner.rb create mode 100644 lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb create mode 100644 lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb create mode 100644 lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb create mode 100644 lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb create mode 100644 lib/tremendous/models/list_rewards401_response.rb create mode 100644 lib/tremendous/models/list_rewards401_response_errors.rb create mode 100644 lib/tremendous/models/list_rewards429_response.rb create mode 100644 lib/tremendous/models/list_webhook_events200_response.rb create mode 100644 lib/tremendous/models/list_webhooks200_response.rb create mode 100644 lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb create mode 100644 lib/tremendous/models/member.rb create mode 100644 lib/tremendous/models/member_base.rb create mode 100644 lib/tremendous/models/member_with_events.rb create mode 100644 lib/tremendous/models/member_without_events.rb create mode 100644 lib/tremendous/models/order.rb create mode 100644 lib/tremendous/models/order_base.rb create mode 100644 lib/tremendous/models/order_base_payment.rb create mode 100644 lib/tremendous/models/order_for_create.rb create mode 100644 lib/tremendous/models/order_for_create_reward.rb create mode 100644 lib/tremendous/models/order_status.rb create mode 100644 lib/tremendous/models/order_with_link.rb create mode 100644 lib/tremendous/models/order_with_link_rewards_inner.rb create mode 100644 lib/tremendous/models/order_without_link.rb create mode 100644 lib/tremendous/models/order_without_link_reward.rb create mode 100644 lib/tremendous/models/organization.rb create mode 100644 lib/tremendous/models/payment_details.rb create mode 100644 lib/tremendous/models/payment_details_refund.rb create mode 100644 lib/tremendous/models/product.rb create mode 100644 lib/tremendous/models/recipient.rb create mode 100644 lib/tremendous/models/refund_details.rb create mode 100644 lib/tremendous/models/resend_reward422_response.rb create mode 100644 lib/tremendous/models/reward.rb create mode 100644 lib/tremendous/models/reward_base.rb create mode 100644 lib/tremendous/models/reward_base_custom_fields_inner.rb create mode 100644 lib/tremendous/models/reward_for_order_create.rb create mode 100644 lib/tremendous/models/reward_link.rb create mode 100644 lib/tremendous/models/reward_token.rb create mode 100644 lib/tremendous/models/reward_value.rb create mode 100644 lib/tremendous/models/reward_with_link.rb create mode 100644 lib/tremendous/models/reward_with_link_delivery.rb create mode 100644 lib/tremendous/models/reward_without_link.rb create mode 100644 lib/tremendous/models/reward_without_link_delivery.rb create mode 100644 lib/tremendous/models/simulate_webhook_request.rb create mode 100644 lib/tremendous/models/webhook.rb create mode 100644 lib/tremendous/models/webhook_post.rb create mode 100644 lib/tremendous/version.rb create mode 100644 spec/api/balance_transactions_api_spec.rb create mode 100644 spec/api/campaigns_api_spec.rb create mode 100644 spec/api/fields_api_spec.rb create mode 100644 spec/api/funding_sources_api_spec.rb create mode 100644 spec/api/invoices_api_spec.rb create mode 100644 spec/api/members_api_spec.rb create mode 100644 spec/api/orders_api_spec.rb create mode 100644 spec/api/organizations_api_spec.rb create mode 100644 spec/api/products_api_spec.rb create mode 100644 spec/api/rewards_api_spec.rb create mode 100644 spec/api/webhooks_api_spec.rb create mode 100644 spec/models/balance_transaction_spec.rb create mode 100644 spec/models/campaign_spec.rb create mode 100644 spec/models/create_api_key200_response_spec.rb create mode 100644 spec/models/create_invoice200_response_spec.rb create mode 100644 spec/models/create_invoice_request_spec.rb create mode 100644 spec/models/create_invoice_spec.rb create mode 100644 spec/models/create_member200_response_spec.rb create mode 100644 spec/models/create_member_request_spec.rb create mode 100644 spec/models/create_member_spec.rb create mode 100644 spec/models/create_order200_response_order_rewards_inner_delivery_spec.rb create mode 100644 spec/models/create_order200_response_order_rewards_inner_spec.rb create mode 100644 spec/models/create_order200_response_order_spec.rb create mode 100644 spec/models/create_order200_response_spec.rb create mode 100644 spec/models/create_order201_response_spec.rb create mode 100644 spec/models/create_order_request_payment_spec.rb create mode 100644 spec/models/create_order_request_reward_delivery_spec.rb create mode 100644 spec/models/create_order_request_reward_spec.rb create mode 100644 spec/models/create_order_request_spec.rb create mode 100644 spec/models/create_organization200_response_organization_spec.rb create mode 100644 spec/models/create_organization200_response_spec.rb create mode 100644 spec/models/create_organization_request_copy_settings_spec.rb create mode 100644 spec/models/create_organization_request_spec.rb create mode 100644 spec/models/create_organization_spec.rb create mode 100644 spec/models/create_webhook200_response_spec.rb create mode 100644 spec/models/create_webhook_request_spec.rb create mode 100644 spec/models/currency_codes_spec.rb create mode 100644 spec/models/custom_field_spec.rb create mode 100644 spec/models/delivery_details_spec.rb create mode 100644 spec/models/delivery_details_with_link_spec.rb create mode 100644 spec/models/delivery_method_spec.rb create mode 100644 spec/models/delivery_status_spec.rb create mode 100644 spec/models/error_model_spec.rb create mode 100644 spec/models/field_spec.rb create mode 100644 spec/models/funding_source_spec.rb create mode 100644 spec/models/generate_reward_link200_response_reward_spec.rb create mode 100644 spec/models/generate_reward_link200_response_spec.rb create mode 100644 spec/models/generate_reward_link403_response_spec.rb create mode 100644 spec/models/generate_reward_token200_response_reward_spec.rb create mode 100644 spec/models/generate_reward_token200_response_spec.rb create mode 100644 spec/models/get_campaign200_response_spec.rb create mode 100644 spec/models/get_funding_source200_response_spec.rb create mode 100644 spec/models/get_member200_response_member_events_inner_spec.rb create mode 100644 spec/models/get_member200_response_member_spec.rb create mode 100644 spec/models/get_member200_response_spec.rb create mode 100644 spec/models/get_organization200_response_spec.rb create mode 100644 spec/models/get_product200_response_spec.rb create mode 100644 spec/models/get_reward200_response_spec.rb create mode 100644 spec/models/invoice_spec.rb create mode 100644 spec/models/list_balance_transactions200_response_invoices_inner_spec.rb create mode 100644 spec/models/list_balance_transactions200_response_spec.rb create mode 100644 spec/models/list_campaigns200_response_campaigns_inner_spec.rb create mode 100644 spec/models/list_campaigns200_response_spec.rb create mode 100644 spec/models/list_fields200_response_fields_inner_spec.rb create mode 100644 spec/models/list_fields200_response_spec.rb create mode 100644 spec/models/list_funding_sources200_response_funding_sources_inner_meta_spec.rb create mode 100644 spec/models/list_funding_sources200_response_funding_sources_inner_spec.rb create mode 100644 spec/models/list_funding_sources200_response_spec.rb create mode 100644 spec/models/list_invoices200_response_invoices_inner_spec.rb create mode 100644 spec/models/list_invoices200_response_spec.rb create mode 100644 spec/models/list_members200_response_members_inner_spec.rb create mode 100644 spec/models/list_members200_response_spec.rb create mode 100644 spec/models/list_orders200_response_orders_inner_payment_refund_spec.rb create mode 100644 spec/models/list_orders200_response_orders_inner_payment_spec.rb create mode 100644 spec/models/list_orders200_response_orders_inner_spec.rb create mode 100644 spec/models/list_orders200_response_spec.rb create mode 100644 spec/models/list_organizations200_response_organizations_inner_spec.rb create mode 100644 spec/models/list_organizations200_response_spec.rb create mode 100644 spec/models/list_products200_response_products_inner_countries_inner_spec.rb create mode 100644 spec/models/list_products200_response_products_inner_images_inner_spec.rb create mode 100644 spec/models/list_products200_response_products_inner_skus_inner_spec.rb create mode 100644 spec/models/list_products200_response_products_inner_spec.rb create mode 100644 spec/models/list_products200_response_spec.rb create mode 100644 spec/models/list_rewards200_response_rewards_inner_custom_fields_inner_spec.rb create mode 100644 spec/models/list_rewards200_response_rewards_inner_delivery_spec.rb create mode 100644 spec/models/list_rewards200_response_rewards_inner_recipient_spec.rb create mode 100644 spec/models/list_rewards200_response_rewards_inner_spec.rb create mode 100644 spec/models/list_rewards200_response_rewards_inner_value_spec.rb create mode 100644 spec/models/list_rewards200_response_spec.rb create mode 100644 spec/models/list_rewards401_response_errors_spec.rb create mode 100644 spec/models/list_rewards401_response_spec.rb create mode 100644 spec/models/list_rewards429_response_spec.rb create mode 100644 spec/models/list_webhook_events200_response_spec.rb create mode 100644 spec/models/list_webhooks200_response_spec.rb create mode 100644 spec/models/list_webhooks200_response_webhooks_inner_spec.rb create mode 100644 spec/models/member_base_spec.rb create mode 100644 spec/models/member_spec.rb create mode 100644 spec/models/member_with_events_spec.rb create mode 100644 spec/models/member_without_events_spec.rb create mode 100644 spec/models/order_base_payment_spec.rb create mode 100644 spec/models/order_base_spec.rb create mode 100644 spec/models/order_for_create_reward_spec.rb create mode 100644 spec/models/order_for_create_spec.rb create mode 100644 spec/models/order_spec.rb create mode 100644 spec/models/order_status_spec.rb create mode 100644 spec/models/order_with_link_rewards_inner_spec.rb create mode 100644 spec/models/order_with_link_spec.rb create mode 100644 spec/models/order_without_link_reward_spec.rb create mode 100644 spec/models/order_without_link_spec.rb create mode 100644 spec/models/organization_spec.rb create mode 100644 spec/models/payment_details_refund_spec.rb create mode 100644 spec/models/payment_details_spec.rb create mode 100644 spec/models/product_spec.rb create mode 100644 spec/models/recipient_spec.rb create mode 100644 spec/models/refund_details_spec.rb create mode 100644 spec/models/resend_reward422_response_spec.rb create mode 100644 spec/models/reward_base_custom_fields_inner_spec.rb create mode 100644 spec/models/reward_base_spec.rb create mode 100644 spec/models/reward_for_order_create_spec.rb create mode 100644 spec/models/reward_link_spec.rb create mode 100644 spec/models/reward_spec.rb create mode 100644 spec/models/reward_token_spec.rb create mode 100644 spec/models/reward_value_spec.rb create mode 100644 spec/models/reward_with_link_delivery_spec.rb create mode 100644 spec/models/reward_with_link_spec.rb create mode 100644 spec/models/reward_without_link_delivery_spec.rb create mode 100644 spec/models/reward_without_link_spec.rb create mode 100644 spec/models/simulate_webhook_request_spec.rb create mode 100644 spec/models/webhook_post_spec.rb create mode 100644 spec/models/webhook_spec.rb create mode 100644 spec/spec_helper.rb create mode 100644 tremendous.gemspec diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..1a1f4c5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +.github/workflows @tremendous-rewards/platform diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e7597fd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml new file mode 100644 index 0000000..93b6564 --- /dev/null +++ b/.github/workflows/check-updates.yml @@ -0,0 +1,20 @@ +name: Check if the Open API has changed +on: + schedule: + - cron: '0 */6 * * *' + +jobs: + check-update: + if: github.repository == 'tremendous-rewards/tremendous-node' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - id: check-update + run: ./bin/check-updates + + - id: create-issue + if: ${{ steps.check-update.outputs.changed == 'true' }} + uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 + with: + update_existing: false + filename: .github/needs-update-template.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d7807b8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,20 @@ +name: Publish package to Rubygems +on: + release: + types: [published] + +permissions: + id-token: write + +jobs: + publish: + if: github.repository == 'tremendous-rewards/tremendous-ruby' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + - uses: rubygems/release-gem@v1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..071b31c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Run tests + +on: + push: + branches-ignore: + - 'dependabot/**' + tags-ignore: + - 'v*' + pull_request_target: + branches: + - 'main' + +jobs: + test: + if: github.repository == 'tremendous-rewards/tremendous-ruby' + runs-on: ubuntu-latest + + strategy: + matrix: + ruby-version: ['3.1', '3.2', '3.3'] + + steps: + - uses: actions/checkout@v4 + - name: Use Ruby ${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - run: rake + env: + SANDBOX_API_TOKEN: ${{ secrets.SANDBOX_API_TOKEN }} + TEST_CAMPAIGN_ID: ${{ secrets.TEST_CAMPAIGN_ID }} + TEST_PRODUCT_ID: ${{ secrets.TEST_PRODUCT_ID }} + TEST_RECIPIENT_EMAIL: ${{ secrets.TEST_RECIPIENT_EMAIL }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..05a17cb --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ +/tmp/ + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..9739bd8 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,31 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md +lib/tremendous/version.rb +.gitignore +Gemfile +Rakefile +tremendous.gemspec +README.md +.rspec +.rubocop.yml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..abd99c9 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,268 @@ +.gitlab-ci.yml +.travis.yml +docs/BalanceTransaction.md +docs/BalanceTransactionsApi.md +docs/Campaign.md +docs/CampaignsApi.md +docs/CreateApiKey200Response.md +docs/CreateInvoice.md +docs/CreateInvoice200Response.md +docs/CreateInvoiceRequest.md +docs/CreateMember.md +docs/CreateMember200Response.md +docs/CreateMemberRequest.md +docs/CreateOrder200Response.md +docs/CreateOrder200ResponseOrder.md +docs/CreateOrder200ResponseOrderRewardsInner.md +docs/CreateOrder200ResponseOrderRewardsInnerDelivery.md +docs/CreateOrder201Response.md +docs/CreateOrderRequest.md +docs/CreateOrderRequestPayment.md +docs/CreateOrderRequestReward.md +docs/CreateOrderRequestRewardDelivery.md +docs/CreateOrganization.md +docs/CreateOrganization200Response.md +docs/CreateOrganization200ResponseOrganization.md +docs/CreateOrganizationRequest.md +docs/CreateOrganizationRequestCopySettings.md +docs/CreateWebhook200Response.md +docs/CreateWebhookRequest.md +docs/CurrencyCodes.md +docs/CustomField.md +docs/DeliveryDetails.md +docs/DeliveryDetailsWithLink.md +docs/DeliveryMethod.md +docs/DeliveryStatus.md +docs/ErrorModel.md +docs/Field.md +docs/FieldsApi.md +docs/FundingSource.md +docs/FundingSourcesApi.md +docs/GenerateRewardLink200Response.md +docs/GenerateRewardLink200ResponseReward.md +docs/GenerateRewardLink403Response.md +docs/GenerateRewardToken200Response.md +docs/GenerateRewardToken200ResponseReward.md +docs/GetCampaign200Response.md +docs/GetFundingSource200Response.md +docs/GetMember200Response.md +docs/GetMember200ResponseMember.md +docs/GetMember200ResponseMemberEventsInner.md +docs/GetOrganization200Response.md +docs/GetProduct200Response.md +docs/GetReward200Response.md +docs/Invoice.md +docs/InvoicesApi.md +docs/ListBalanceTransactions200Response.md +docs/ListBalanceTransactions200ResponseInvoicesInner.md +docs/ListCampaigns200Response.md +docs/ListCampaigns200ResponseCampaignsInner.md +docs/ListFields200Response.md +docs/ListFields200ResponseFieldsInner.md +docs/ListFundingSources200Response.md +docs/ListFundingSources200ResponseFundingSourcesInner.md +docs/ListFundingSources200ResponseFundingSourcesInnerMeta.md +docs/ListInvoices200Response.md +docs/ListInvoices200ResponseInvoicesInner.md +docs/ListMembers200Response.md +docs/ListMembers200ResponseMembersInner.md +docs/ListOrders200Response.md +docs/ListOrders200ResponseOrdersInner.md +docs/ListOrders200ResponseOrdersInnerPayment.md +docs/ListOrders200ResponseOrdersInnerPaymentRefund.md +docs/ListOrganizations200Response.md +docs/ListOrganizations200ResponseOrganizationsInner.md +docs/ListProducts200Response.md +docs/ListProducts200ResponseProductsInner.md +docs/ListProducts200ResponseProductsInnerCountriesInner.md +docs/ListProducts200ResponseProductsInnerImagesInner.md +docs/ListProducts200ResponseProductsInnerSkusInner.md +docs/ListRewards200Response.md +docs/ListRewards200ResponseRewardsInner.md +docs/ListRewards200ResponseRewardsInnerCustomFieldsInner.md +docs/ListRewards200ResponseRewardsInnerDelivery.md +docs/ListRewards200ResponseRewardsInnerRecipient.md +docs/ListRewards200ResponseRewardsInnerValue.md +docs/ListRewards401Response.md +docs/ListRewards401ResponseErrors.md +docs/ListRewards429Response.md +docs/ListWebhookEvents200Response.md +docs/ListWebhooks200Response.md +docs/ListWebhooks200ResponseWebhooksInner.md +docs/Member.md +docs/MemberBase.md +docs/MemberWithEvents.md +docs/MemberWithoutEvents.md +docs/MembersApi.md +docs/Order.md +docs/OrderBase.md +docs/OrderBasePayment.md +docs/OrderForCreate.md +docs/OrderForCreateReward.md +docs/OrderStatus.md +docs/OrderWithLink.md +docs/OrderWithLinkRewardsInner.md +docs/OrderWithoutLink.md +docs/OrderWithoutLinkReward.md +docs/OrdersApi.md +docs/Organization.md +docs/OrganizationsApi.md +docs/PaymentDetails.md +docs/PaymentDetailsRefund.md +docs/Product.md +docs/ProductsApi.md +docs/Recipient.md +docs/RefundDetails.md +docs/ResendReward422Response.md +docs/Reward.md +docs/RewardBase.md +docs/RewardBaseCustomFieldsInner.md +docs/RewardForOrderCreate.md +docs/RewardLink.md +docs/RewardToken.md +docs/RewardValue.md +docs/RewardWithLink.md +docs/RewardWithLinkDelivery.md +docs/RewardWithoutLink.md +docs/RewardWithoutLinkDelivery.md +docs/RewardsApi.md +docs/SimulateWebhookRequest.md +docs/Webhook.md +docs/WebhookPost.md +docs/WebhooksApi.md +git_push.sh +lib/tremendous.rb +lib/tremendous/api/balance_transactions_api.rb +lib/tremendous/api/campaigns_api.rb +lib/tremendous/api/fields_api.rb +lib/tremendous/api/funding_sources_api.rb +lib/tremendous/api/invoices_api.rb +lib/tremendous/api/members_api.rb +lib/tremendous/api/orders_api.rb +lib/tremendous/api/organizations_api.rb +lib/tremendous/api/products_api.rb +lib/tremendous/api/rewards_api.rb +lib/tremendous/api/webhooks_api.rb +lib/tremendous/api_client.rb +lib/tremendous/api_error.rb +lib/tremendous/configuration.rb +lib/tremendous/models/balance_transaction.rb +lib/tremendous/models/campaign.rb +lib/tremendous/models/create_api_key200_response.rb +lib/tremendous/models/create_invoice.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_order_request_payment.rb +lib/tremendous/models/create_order_request_reward.rb +lib/tremendous/models/create_order_request_reward_delivery.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_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/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/field.rb +lib/tremendous/models/funding_source.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_campaign200_response.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_product200_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_invoices_inner.rb +lib/tremendous/models/list_campaigns200_response.rb +lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +lib/tremendous/models/list_fields200_response.rb +lib/tremendous/models/list_fields200_response_fields_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_products200_response.rb +lib/tremendous/models/list_products200_response_products_inner.rb +lib/tremendous/models/list_products200_response_products_inner_countries_inner.rb +lib/tremendous/models/list_products200_response_products_inner_images_inner.rb +lib/tremendous/models/list_products200_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_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_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_for_create.rb +lib/tremendous/models/order_for_create_reward.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_reward.rb +lib/tremendous/models/organization.rb +lib/tremendous/models/payment_details.rb +lib/tremendous/models/payment_details_refund.rb +lib/tremendous/models/product.rb +lib/tremendous/models/recipient.rb +lib/tremendous/models/refund_details.rb +lib/tremendous/models/resend_reward422_response.rb +lib/tremendous/models/reward.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_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/simulate_webhook_request.rb +lib/tremendous/models/webhook.rb +lib/tremendous/models/webhook_post.rb +spec/spec_helper.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..fff4bdd --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.3.0-SNAPSHOT \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..2c5e89f --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gemspec + +gem "rake" +gem "rspec" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..ec1a813 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,47 @@ +PATH + remote: . + specs: + tremendous_ruby (5.0.0) + faraday (>= 1.0.1, < 3.0) + faraday-multipart + +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (1.5.1) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (3.1.0) + net-http + multipart-post (2.4.0) + net-http (0.4.1) + uri + rake (13.1.0) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + uri (0.13.0) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + rake + rspec + tremendous_ruby! + +BUNDLED WITH + 2.5.3 diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b07907 --- /dev/null +++ b/README.md @@ -0,0 +1,261 @@ +# tremendous + +Tremendous - the Ruby gem for the 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. + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 2 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.RubyClientCodegen + +## Installation + +### Build a gem + +To build the Ruby code into a gem: + +```shell +gem build tremendous.gemspec +``` + +Then either install the gem locally: + +```shell +gem install ./tremendous-1.0.0.gem +``` + +(for development, run `gem install --dev ./tremendous-1.0.0.gem` to install the development dependencies) + +or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). + +Finally add this to the Gemfile: + + gem 'tremendous', '~> 1.0.0' + +### Install from Git + +If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile: + + gem 'tremendous', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git' + +### Include the Ruby code directly + +Include the Ruby code directly using `-I` as follows: + +```shell +ruby -Ilib script.rb +``` + +## Getting Started + +Please follow the [installation](#installation) procedure and then run the following code: + +```ruby +# Load the gem +require 'tremendous' + +# Setup authorization +Tremendous.configure do |config| + # Configure Bearer authorization: BearerApiKey + config.access_token = 'YOUR_BEARER_TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } + # Configure faraday connection + config.configure_faraday_connection { |connection| 'YOUR CONNECTION CONFIG PROC' } +end + +api_instance = Tremendous::BalanceTransactionsApi.new +opts = { + offset: 10, # Integer | Offsets the returned list by the given number of transactions. The returned transactions are ordered (and offsetted) by their creation date (DESC). + limit: 10, # Integer | Limits the number of transactions listed. The default value is 10. + created_at_gte: '2023-07-15T18:00:00Z', # String | Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + created_at_lte: '2023-08-01T18:00:00Z' # String | Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. +} + +begin + #List balance transactions + result = api_instance.list_balance_transactions(opts) + p result +rescue Tremendous::ApiError => e + puts "Exception when calling BalanceTransactionsApi->list_balance_transactions: #{e}" +end + +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://testflight.tremendous.com/api/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*Tremendous::BalanceTransactionsApi* | [**list_balance_transactions**](docs/BalanceTransactionsApi.md#list_balance_transactions) | **GET** /balance_transactions | List balance transactions +*Tremendous::CampaignsApi* | [**get_campaign**](docs/CampaignsApi.md#get_campaign) | **GET** /campaigns/{id} | Retrieve campaign +*Tremendous::CampaignsApi* | [**list_campaigns**](docs/CampaignsApi.md#list_campaigns) | **GET** /campaigns | List campaigns +*Tremendous::FieldsApi* | [**list_fields**](docs/FieldsApi.md#list_fields) | **GET** /fields | List fields +*Tremendous::FundingSourcesApi* | [**get_funding_source**](docs/FundingSourcesApi.md#get_funding_source) | **GET** /funding_sources/{id} | Retrieve funding source +*Tremendous::FundingSourcesApi* | [**list_funding_sources**](docs/FundingSourcesApi.md#list_funding_sources) | **GET** /funding_sources | List funding sources +*Tremendous::InvoicesApi* | [**create_invoice**](docs/InvoicesApi.md#create_invoice) | **POST** /invoices | Create invoice +*Tremendous::InvoicesApi* | [**delete_invoices**](docs/InvoicesApi.md#delete_invoices) | **DELETE** /invoices/{id} | Delete invoice +*Tremendous::InvoicesApi* | [**download_invoice_csv**](docs/InvoicesApi.md#download_invoice_csv) | **GET** /invoices/{id}/csv | Retrieve invoice as CSV +*Tremendous::InvoicesApi* | [**download_invoice_pdf**](docs/InvoicesApi.md#download_invoice_pdf) | **GET** /invoices/{id}/pdf | Retrieve invoice as PDF +*Tremendous::InvoicesApi* | [**get_invoice**](docs/InvoicesApi.md#get_invoice) | **GET** /invoices/{id} | Retrieve invoice +*Tremendous::InvoicesApi* | [**list_invoices**](docs/InvoicesApi.md#list_invoices) | **GET** /invoices | List invoices +*Tremendous::MembersApi* | [**create_member**](docs/MembersApi.md#create_member) | **POST** /members | Create member +*Tremendous::MembersApi* | [**get_member**](docs/MembersApi.md#get_member) | **GET** /members/{id} | Retrieve member +*Tremendous::MembersApi* | [**list_members**](docs/MembersApi.md#list_members) | **GET** /members | List members +*Tremendous::OrdersApi* | [**approve_order**](docs/OrdersApi.md#approve_order) | **POST** /order_approvals/{id}/approve | Approve order +*Tremendous::OrdersApi* | [**create_order**](docs/OrdersApi.md#create_order) | **POST** /orders | Create order +*Tremendous::OrdersApi* | [**get_order**](docs/OrdersApi.md#get_order) | **GET** /orders/{id} | Retrieve order +*Tremendous::OrdersApi* | [**list_orders**](docs/OrdersApi.md#list_orders) | **GET** /orders | List orders +*Tremendous::OrdersApi* | [**reject_order**](docs/OrdersApi.md#reject_order) | **POST** /order_approvals/{id}/reject | Reject order +*Tremendous::OrganizationsApi* | [**create_api_key**](docs/OrganizationsApi.md#create_api_key) | **POST** /organizations/create_api_key | Create API key +*Tremendous::OrganizationsApi* | [**create_organization**](docs/OrganizationsApi.md#create_organization) | **POST** /organizations | Create organization +*Tremendous::OrganizationsApi* | [**get_organization**](docs/OrganizationsApi.md#get_organization) | **GET** /organizations/{id} | Retrieve organization +*Tremendous::OrganizationsApi* | [**list_organizations**](docs/OrganizationsApi.md#list_organizations) | **GET** /organizations | List organizations +*Tremendous::ProductsApi* | [**get_product**](docs/ProductsApi.md#get_product) | **GET** /products/{id} | Retrieve product +*Tremendous::ProductsApi* | [**list_products**](docs/ProductsApi.md#list_products) | **GET** /products | List products +*Tremendous::RewardsApi* | [**generate_reward_link**](docs/RewardsApi.md#generate_reward_link) | **POST** /rewards/{id}/generate_link | Generate a reward URL +*Tremendous::RewardsApi* | [**generate_reward_token**](docs/RewardsApi.md#generate_reward_token) | **POST** /rewards/{id}/generate_embed_token | Generate a reward token +*Tremendous::RewardsApi* | [**get_reward**](docs/RewardsApi.md#get_reward) | **GET** /rewards/{id} | Retrieve single reward +*Tremendous::RewardsApi* | [**list_rewards**](docs/RewardsApi.md#list_rewards) | **GET** /rewards | List rewards +*Tremendous::RewardsApi* | [**resend_reward**](docs/RewardsApi.md#resend_reward) | **POST** /rewards/{id}/resend | Resend reward +*Tremendous::WebhooksApi* | [**create_webhook**](docs/WebhooksApi.md#create_webhook) | **POST** /webhooks | Create webhook +*Tremendous::WebhooksApi* | [**get_webhook**](docs/WebhooksApi.md#get_webhook) | **GET** /webhooks/{id} | Retrieve webhook +*Tremendous::WebhooksApi* | [**list_webhook_events**](docs/WebhooksApi.md#list_webhook_events) | **GET** /webhooks/{id}/events | List events +*Tremendous::WebhooksApi* | [**list_webhooks**](docs/WebhooksApi.md#list_webhooks) | **GET** /webhooks | List webhooks +*Tremendous::WebhooksApi* | [**simulate_webhook**](docs/WebhooksApi.md#simulate_webhook) | **POST** /webhooks/{id}/simulate | Test webhook + + +## Documentation for Models + + - [Tremendous::BalanceTransaction](docs/BalanceTransaction.md) + - [Tremendous::Campaign](docs/Campaign.md) + - [Tremendous::CreateApiKey200Response](docs/CreateApiKey200Response.md) + - [Tremendous::CreateInvoice](docs/CreateInvoice.md) + - [Tremendous::CreateInvoice200Response](docs/CreateInvoice200Response.md) + - [Tremendous::CreateInvoiceRequest](docs/CreateInvoiceRequest.md) + - [Tremendous::CreateMember](docs/CreateMember.md) + - [Tremendous::CreateMember200Response](docs/CreateMember200Response.md) + - [Tremendous::CreateMemberRequest](docs/CreateMemberRequest.md) + - [Tremendous::CreateOrder200Response](docs/CreateOrder200Response.md) + - [Tremendous::CreateOrder200ResponseOrder](docs/CreateOrder200ResponseOrder.md) + - [Tremendous::CreateOrder200ResponseOrderRewardsInner](docs/CreateOrder200ResponseOrderRewardsInner.md) + - [Tremendous::CreateOrder200ResponseOrderRewardsInnerDelivery](docs/CreateOrder200ResponseOrderRewardsInnerDelivery.md) + - [Tremendous::CreateOrder201Response](docs/CreateOrder201Response.md) + - [Tremendous::CreateOrderRequest](docs/CreateOrderRequest.md) + - [Tremendous::CreateOrderRequestPayment](docs/CreateOrderRequestPayment.md) + - [Tremendous::CreateOrderRequestReward](docs/CreateOrderRequestReward.md) + - [Tremendous::CreateOrderRequestRewardDelivery](docs/CreateOrderRequestRewardDelivery.md) + - [Tremendous::CreateOrganization](docs/CreateOrganization.md) + - [Tremendous::CreateOrganization200Response](docs/CreateOrganization200Response.md) + - [Tremendous::CreateOrganization200ResponseOrganization](docs/CreateOrganization200ResponseOrganization.md) + - [Tremendous::CreateOrganizationRequest](docs/CreateOrganizationRequest.md) + - [Tremendous::CreateOrganizationRequestCopySettings](docs/CreateOrganizationRequestCopySettings.md) + - [Tremendous::CreateWebhook200Response](docs/CreateWebhook200Response.md) + - [Tremendous::CreateWebhookRequest](docs/CreateWebhookRequest.md) + - [Tremendous::CurrencyCodes](docs/CurrencyCodes.md) + - [Tremendous::CustomField](docs/CustomField.md) + - [Tremendous::DeliveryDetails](docs/DeliveryDetails.md) + - [Tremendous::DeliveryDetailsWithLink](docs/DeliveryDetailsWithLink.md) + - [Tremendous::DeliveryMethod](docs/DeliveryMethod.md) + - [Tremendous::DeliveryStatus](docs/DeliveryStatus.md) + - [Tremendous::ErrorModel](docs/ErrorModel.md) + - [Tremendous::Field](docs/Field.md) + - [Tremendous::FundingSource](docs/FundingSource.md) + - [Tremendous::GenerateRewardLink200Response](docs/GenerateRewardLink200Response.md) + - [Tremendous::GenerateRewardLink200ResponseReward](docs/GenerateRewardLink200ResponseReward.md) + - [Tremendous::GenerateRewardLink403Response](docs/GenerateRewardLink403Response.md) + - [Tremendous::GenerateRewardToken200Response](docs/GenerateRewardToken200Response.md) + - [Tremendous::GenerateRewardToken200ResponseReward](docs/GenerateRewardToken200ResponseReward.md) + - [Tremendous::GetCampaign200Response](docs/GetCampaign200Response.md) + - [Tremendous::GetFundingSource200Response](docs/GetFundingSource200Response.md) + - [Tremendous::GetMember200Response](docs/GetMember200Response.md) + - [Tremendous::GetMember200ResponseMember](docs/GetMember200ResponseMember.md) + - [Tremendous::GetMember200ResponseMemberEventsInner](docs/GetMember200ResponseMemberEventsInner.md) + - [Tremendous::GetOrganization200Response](docs/GetOrganization200Response.md) + - [Tremendous::GetProduct200Response](docs/GetProduct200Response.md) + - [Tremendous::GetReward200Response](docs/GetReward200Response.md) + - [Tremendous::Invoice](docs/Invoice.md) + - [Tremendous::ListBalanceTransactions200Response](docs/ListBalanceTransactions200Response.md) + - [Tremendous::ListBalanceTransactions200ResponseInvoicesInner](docs/ListBalanceTransactions200ResponseInvoicesInner.md) + - [Tremendous::ListCampaigns200Response](docs/ListCampaigns200Response.md) + - [Tremendous::ListCampaigns200ResponseCampaignsInner](docs/ListCampaigns200ResponseCampaignsInner.md) + - [Tremendous::ListFields200Response](docs/ListFields200Response.md) + - [Tremendous::ListFields200ResponseFieldsInner](docs/ListFields200ResponseFieldsInner.md) + - [Tremendous::ListFundingSources200Response](docs/ListFundingSources200Response.md) + - [Tremendous::ListFundingSources200ResponseFundingSourcesInner](docs/ListFundingSources200ResponseFundingSourcesInner.md) + - [Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta](docs/ListFundingSources200ResponseFundingSourcesInnerMeta.md) + - [Tremendous::ListInvoices200Response](docs/ListInvoices200Response.md) + - [Tremendous::ListInvoices200ResponseInvoicesInner](docs/ListInvoices200ResponseInvoicesInner.md) + - [Tremendous::ListMembers200Response](docs/ListMembers200Response.md) + - [Tremendous::ListMembers200ResponseMembersInner](docs/ListMembers200ResponseMembersInner.md) + - [Tremendous::ListOrders200Response](docs/ListOrders200Response.md) + - [Tremendous::ListOrders200ResponseOrdersInner](docs/ListOrders200ResponseOrdersInner.md) + - [Tremendous::ListOrders200ResponseOrdersInnerPayment](docs/ListOrders200ResponseOrdersInnerPayment.md) + - [Tremendous::ListOrders200ResponseOrdersInnerPaymentRefund](docs/ListOrders200ResponseOrdersInnerPaymentRefund.md) + - [Tremendous::ListOrganizations200Response](docs/ListOrganizations200Response.md) + - [Tremendous::ListOrganizations200ResponseOrganizationsInner](docs/ListOrganizations200ResponseOrganizationsInner.md) + - [Tremendous::ListProducts200Response](docs/ListProducts200Response.md) + - [Tremendous::ListProducts200ResponseProductsInner](docs/ListProducts200ResponseProductsInner.md) + - [Tremendous::ListProducts200ResponseProductsInnerCountriesInner](docs/ListProducts200ResponseProductsInnerCountriesInner.md) + - [Tremendous::ListProducts200ResponseProductsInnerImagesInner](docs/ListProducts200ResponseProductsInnerImagesInner.md) + - [Tremendous::ListProducts200ResponseProductsInnerSkusInner](docs/ListProducts200ResponseProductsInnerSkusInner.md) + - [Tremendous::ListRewards200Response](docs/ListRewards200Response.md) + - [Tremendous::ListRewards200ResponseRewardsInner](docs/ListRewards200ResponseRewardsInner.md) + - [Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner](docs/ListRewards200ResponseRewardsInnerCustomFieldsInner.md) + - [Tremendous::ListRewards200ResponseRewardsInnerDelivery](docs/ListRewards200ResponseRewardsInnerDelivery.md) + - [Tremendous::ListRewards200ResponseRewardsInnerRecipient](docs/ListRewards200ResponseRewardsInnerRecipient.md) + - [Tremendous::ListRewards200ResponseRewardsInnerValue](docs/ListRewards200ResponseRewardsInnerValue.md) + - [Tremendous::ListRewards401Response](docs/ListRewards401Response.md) + - [Tremendous::ListRewards401ResponseErrors](docs/ListRewards401ResponseErrors.md) + - [Tremendous::ListRewards429Response](docs/ListRewards429Response.md) + - [Tremendous::ListWebhookEvents200Response](docs/ListWebhookEvents200Response.md) + - [Tremendous::ListWebhooks200Response](docs/ListWebhooks200Response.md) + - [Tremendous::ListWebhooks200ResponseWebhooksInner](docs/ListWebhooks200ResponseWebhooksInner.md) + - [Tremendous::Member](docs/Member.md) + - [Tremendous::MemberBase](docs/MemberBase.md) + - [Tremendous::MemberWithEvents](docs/MemberWithEvents.md) + - [Tremendous::MemberWithoutEvents](docs/MemberWithoutEvents.md) + - [Tremendous::Order](docs/Order.md) + - [Tremendous::OrderBase](docs/OrderBase.md) + - [Tremendous::OrderBasePayment](docs/OrderBasePayment.md) + - [Tremendous::OrderForCreate](docs/OrderForCreate.md) + - [Tremendous::OrderForCreateReward](docs/OrderForCreateReward.md) + - [Tremendous::OrderStatus](docs/OrderStatus.md) + - [Tremendous::OrderWithLink](docs/OrderWithLink.md) + - [Tremendous::OrderWithLinkRewardsInner](docs/OrderWithLinkRewardsInner.md) + - [Tremendous::OrderWithoutLink](docs/OrderWithoutLink.md) + - [Tremendous::OrderWithoutLinkReward](docs/OrderWithoutLinkReward.md) + - [Tremendous::Organization](docs/Organization.md) + - [Tremendous::PaymentDetails](docs/PaymentDetails.md) + - [Tremendous::PaymentDetailsRefund](docs/PaymentDetailsRefund.md) + - [Tremendous::Product](docs/Product.md) + - [Tremendous::Recipient](docs/Recipient.md) + - [Tremendous::RefundDetails](docs/RefundDetails.md) + - [Tremendous::ResendReward422Response](docs/ResendReward422Response.md) + - [Tremendous::Reward](docs/Reward.md) + - [Tremendous::RewardBase](docs/RewardBase.md) + - [Tremendous::RewardBaseCustomFieldsInner](docs/RewardBaseCustomFieldsInner.md) + - [Tremendous::RewardForOrderCreate](docs/RewardForOrderCreate.md) + - [Tremendous::RewardLink](docs/RewardLink.md) + - [Tremendous::RewardToken](docs/RewardToken.md) + - [Tremendous::RewardValue](docs/RewardValue.md) + - [Tremendous::RewardWithLink](docs/RewardWithLink.md) + - [Tremendous::RewardWithLinkDelivery](docs/RewardWithLinkDelivery.md) + - [Tremendous::RewardWithoutLink](docs/RewardWithoutLink.md) + - [Tremendous::RewardWithoutLinkDelivery](docs/RewardWithoutLinkDelivery.md) + - [Tremendous::SimulateWebhookRequest](docs/SimulateWebhookRequest.md) + - [Tremendous::Webhook](docs/Webhook.md) + - [Tremendous::WebhookPost](docs/WebhookPost.md) + + +## Documentation for Authorization + + +Authentication schemes defined for the API: +### BearerApiKey + +- **Type**: Bearer authentication + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1c6d6d6 --- /dev/null +++ b/Rakefile @@ -0,0 +1,11 @@ +require "rubygems" +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +task default: :spec + +task :console do + exec "irb -r tremendous -I ./lib" +end diff --git a/bin/check-updates b/bin/check-updates new file mode 100755 index 0000000..bb94666 --- /dev/null +++ b/bin/check-updates @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +test -f "$1" && spec="$1" || spec=$(./bin/download-spec) + +current=$(cat ./*.ts | md5sum | awk '{print $1}') + +./bin/generate "$spec" + +changed=$(cat ./*.ts | md5sum | awk '{print $1}') + +if [[ "$current" == "$changed" ]]; then + echo "Generated code hasn't changed" + test -n "$CI" && echo "changed=false" >> "$GITHUB_OUTPUT" +else + echo "Changes found" + test -n "$CI" && echo "changed=true" >> "$GITHUB_OUTPUT" +fi diff --git a/bin/download-spec b/bin/download-spec new file mode 100755 index 0000000..a572265 --- /dev/null +++ b/bin/download-spec @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +path="./tmp/spec.yml" + +rm -rf $path && \ + curl -o $path https://cdn.tremendous.com/openapi/spec.yml && \ + echo $path diff --git a/bin/generate b/bin/generate new file mode 100755 index 0000000..9e65bfd --- /dev/null +++ b/bin/generate @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +test -f "$1" && spec="$1" || spec=$(./bin/download-spec) + +docker run --rm \ + -v ./:/output \ + -v $(realpath $spec):/spec.yml \ + -v ~/tmp:/input \ + openapitools/openapi-generator-cli generate \ + -i /spec.yml \ + -g ruby \ + -o /output \ + -p library=faraday,gemName=tremendous + # -t /output/templates/ruby \ + +rm -rf git_push.sh .gitlab-ci.yml .travis.yml docs diff --git a/lib/tremendous.rb b/lib/tremendous.rb new file mode 100644 index 0000000..1436ee8 --- /dev/null +++ b/lib/tremendous.rb @@ -0,0 +1,169 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +# Common files +require 'tremendous/api_client' +require 'tremendous/api_error' +require 'tremendous/version' +require 'tremendous/configuration' + +# Models +require 'tremendous/models/balance_transaction' +require 'tremendous/models/campaign' +require 'tremendous/models/create_api_key200_response' +require 'tremendous/models/create_invoice' +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_order_request_payment' +require 'tremendous/models/create_order_request_reward' +require 'tremendous/models/create_order_request_reward_delivery' +require 'tremendous/models/create_organization' +require 'tremendous/models/create_organization200_response' +require 'tremendous/models/create_organization200_response_organization' +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/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/field' +require 'tremendous/models/funding_source' +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_campaign200_response' +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_product200_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_invoices_inner' +require 'tremendous/models/list_campaigns200_response' +require 'tremendous/models/list_campaigns200_response_campaigns_inner' +require 'tremendous/models/list_fields200_response' +require 'tremendous/models/list_fields200_response_fields_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_products200_response' +require 'tremendous/models/list_products200_response_products_inner' +require 'tremendous/models/list_products200_response_products_inner_countries_inner' +require 'tremendous/models/list_products200_response_products_inner_images_inner' +require 'tremendous/models/list_products200_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_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_without_events' +require 'tremendous/models/order' +require 'tremendous/models/order_base' +require 'tremendous/models/order_base_payment' +require 'tremendous/models/order_for_create' +require 'tremendous/models/order_for_create_reward' +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_reward' +require 'tremendous/models/organization' +require 'tremendous/models/payment_details' +require 'tremendous/models/payment_details_refund' +require 'tremendous/models/product' +require 'tremendous/models/recipient' +require 'tremendous/models/refund_details' +require 'tremendous/models/resend_reward422_response' +require 'tremendous/models/reward' +require 'tremendous/models/reward_base' +require 'tremendous/models/reward_base_custom_fields_inner' +require 'tremendous/models/reward_for_order_create' +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/simulate_webhook_request' +require 'tremendous/models/webhook' +require 'tremendous/models/webhook_post' + +# APIs +require 'tremendous/api/balance_transactions_api' +require 'tremendous/api/campaigns_api' +require 'tremendous/api/fields_api' +require 'tremendous/api/funding_sources_api' +require 'tremendous/api/invoices_api' +require 'tremendous/api/members_api' +require 'tremendous/api/orders_api' +require 'tremendous/api/organizations_api' +require 'tremendous/api/products_api' +require 'tremendous/api/rewards_api' +require 'tremendous/api/webhooks_api' + +module Tremendous + class << self + # Customize default settings for the SDK using block. + # Tremendous.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end + end +end diff --git a/lib/tremendous/api/balance_transactions_api.rb b/lib/tremendous/api/balance_transactions_api.rb new file mode 100644 index 0000000..844e003 --- /dev/null +++ b/lib/tremendous/api/balance_transactions_api.rb @@ -0,0 +1,91 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class BalanceTransactionsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # List balance transactions + # Fetch a list of all balance transactions on your account. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of transactions. The returned transactions are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of transactions listed. The default value is 10. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @return [ListBalanceTransactions200Response] + def list_balance_transactions(opts = {}) + data, _status_code, _headers = list_balance_transactions_with_http_info(opts) + data + end + + # List balance transactions + # Fetch a list of all balance transactions on your account. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of transactions. The returned transactions are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of transactions listed. The default value is 10. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @return [Array<(ListBalanceTransactions200Response, Integer, Hash)>] ListBalanceTransactions200Response data, response status code and response headers + def list_balance_transactions_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: BalanceTransactionsApi.list_balance_transactions ...' + end + # resource path + local_var_path = '/balance_transactions' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'created_at[gte]'] = opts[:'created_at_gte'] if !opts[:'created_at_gte'].nil? + query_params[:'created_at[lte]'] = opts[:'created_at_lte'] if !opts[:'created_at_lte'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListBalanceTransactions200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"BalanceTransactionsApi.list_balance_transactions", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: BalanceTransactionsApi#list_balance_transactions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/campaigns_api.rb b/lib/tremendous/api/campaigns_api.rb new file mode 100644 index 0000000..6ffe8ed --- /dev/null +++ b/lib/tremendous/api/campaigns_api.rb @@ -0,0 +1,147 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class CampaignsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieve campaign + # Retrieve a campaign, identified by the given `id` in the URL + # @param id [String] ID of the campaign that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetCampaign200Response] + def get_campaign(id, opts = {}) + data, _status_code, _headers = get_campaign_with_http_info(id, opts) + data + end + + # Retrieve campaign + # Retrieve a campaign, identified by the given `id` in the URL + # @param id [String] ID of the campaign that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(GetCampaign200Response, Integer, Hash)>] GetCampaign200Response data, response status code and response headers + def get_campaign_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CampaignsApi.get_campaign ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling CampaignsApi.get_campaign" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling CampaignsApi.get_campaign, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/campaigns/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCampaign200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"CampaignsApi.get_campaign", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CampaignsApi#get_campaign\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List campaigns + # Retrieve a list of all campaigns created in your account + # @param [Hash] opts the optional parameters + # @return [ListCampaigns200Response] + def list_campaigns(opts = {}) + data, _status_code, _headers = list_campaigns_with_http_info(opts) + data + end + + # List campaigns + # Retrieve a list of all campaigns created in your account + # @param [Hash] opts the optional parameters + # @return [Array<(ListCampaigns200Response, Integer, Hash)>] ListCampaigns200Response data, response status code and response headers + def list_campaigns_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: CampaignsApi.list_campaigns ...' + end + # resource path + local_var_path = '/campaigns' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListCampaigns200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"CampaignsApi.list_campaigns", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: CampaignsApi#list_campaigns\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/fields_api.rb b/lib/tremendous/api/fields_api.rb new file mode 100644 index 0000000..0776d00 --- /dev/null +++ b/lib/tremendous/api/fields_api.rb @@ -0,0 +1,79 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class FieldsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # List fields + # For reporting and analytics purposes, custom fields can be associated with rewards generated through the API. Custom fields must be first added by members of your admin team through the Tremendous Dashboard. + # @param [Hash] opts the optional parameters + # @return [ListFields200Response] + def list_fields(opts = {}) + data, _status_code, _headers = list_fields_with_http_info(opts) + data + end + + # List fields + # For reporting and analytics purposes, custom fields can be associated with rewards generated through the API. Custom fields must be first added by members of your admin team through the Tremendous Dashboard. + # @param [Hash] opts the optional parameters + # @return [Array<(ListFields200Response, Integer, Hash)>] ListFields200Response data, response status code and response headers + def list_fields_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FieldsApi.list_fields ...' + end + # resource path + local_var_path = '/fields' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListFields200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"FieldsApi.list_fields", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FieldsApi#list_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/funding_sources_api.rb b/lib/tremendous/api/funding_sources_api.rb new file mode 100644 index 0000000..fd49528 --- /dev/null +++ b/lib/tremendous/api/funding_sources_api.rb @@ -0,0 +1,147 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class FundingSourcesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieve funding source + # Retrieve a funding source, identified by the given `id` in the URL + # @param id [String] ID of the funding source that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetFundingSource200Response] + def get_funding_source(id, opts = {}) + data, _status_code, _headers = get_funding_source_with_http_info(id, opts) + data + end + + # Retrieve funding source + # Retrieve a funding source, identified by the given `id` in the URL + # @param id [String] ID of the funding source that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(GetFundingSource200Response, Integer, Hash)>] GetFundingSource200Response data, response status code and response headers + def get_funding_source_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FundingSourcesApi.get_funding_source ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling FundingSourcesApi.get_funding_source" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling FundingSourcesApi.get_funding_source, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/funding_sources/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetFundingSource200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"FundingSourcesApi.get_funding_source", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FundingSourcesApi#get_funding_source\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List funding sources + # Retrieve a list of all funding sources available for ordering through the API in your organization's account. + # @param [Hash] opts the optional parameters + # @return [ListFundingSources200Response] + def list_funding_sources(opts = {}) + data, _status_code, _headers = list_funding_sources_with_http_info(opts) + data + end + + # List funding sources + # Retrieve a list of all funding sources available for ordering through the API in your organization's account. + # @param [Hash] opts the optional parameters + # @return [Array<(ListFundingSources200Response, Integer, Hash)>] ListFundingSources200Response data, response status code and response headers + def list_funding_sources_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FundingSourcesApi.list_funding_sources ...' + end + # resource path + local_var_path = '/funding_sources' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListFundingSources200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"FundingSourcesApi.list_funding_sources", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FundingSourcesApi#list_funding_sources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/invoices_api.rb b/lib/tremendous/api/invoices_api.rb new file mode 100644 index 0000000..2331ec7 --- /dev/null +++ b/lib/tremendous/api/invoices_api.rb @@ -0,0 +1,405 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class InvoicesApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + 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.

+ # @param create_invoice_request [CreateInvoiceRequest] Invoice details + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + def create_invoice(create_invoice_request, opts = {}) + data, _status_code, _headers = create_invoice_with_http_info(create_invoice_request, opts) + data + 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> + # @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 + def create_invoice_with_http_info(create_invoice_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.create_invoice ...' + end + # verify the required parameter 'create_invoice_request' is set + if @api_client.config.client_side_validation && create_invoice_request.nil? + fail ArgumentError, "Missing the required parameter 'create_invoice_request' when calling InvoicesApi.create_invoice" + end + # resource path + local_var_path = '/invoices' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_invoice_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateInvoice200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.create_invoice", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#create_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete invoice + # Removes an invoice. This has no further consequences but is a rather cosmetic operation. + # @param id [String] ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + def delete_invoices(id, opts = {}) + data, _status_code, _headers = delete_invoices_with_http_info(id, opts) + data + end + + # Delete invoice + # Removes an invoice. This has no further consequences but is a rather cosmetic operation. + # @param id [String] ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(CreateInvoice200Response, Integer, Hash)>] CreateInvoice200Response data, response status code and response headers + def delete_invoices_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.delete_invoices ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.delete_invoices" + end + # resource path + local_var_path = '/invoices/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateInvoice200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.delete_invoices", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#delete_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve invoice as CSV + # Generates a CSV version for an invoice listing the associated rewards and orders + # @param id [String] ID of the Invoice for that the CSV should be generated + # @param [Hash] opts the optional parameters + # @return [String] + def download_invoice_csv(id, opts = {}) + data, _status_code, _headers = download_invoice_csv_with_http_info(id, opts) + data + end + + # Retrieve invoice as CSV + # Generates a CSV version for an invoice listing the associated rewards and orders + # @param id [String] ID of the Invoice for that the CSV should be generated + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def download_invoice_csv_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_csv ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_csv" + end + # resource path + local_var_path = '/invoices/{id}/csv'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/csv', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.download_invoice_csv", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#download_invoice_csv\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve invoice as PDF + # Generates a PDF version for an invoice + # @param id [String] ID of the Invoice for that the PDF should be generated + # @param [Hash] opts the optional parameters + # @return [File] + def download_invoice_pdf(id, opts = {}) + data, _status_code, _headers = download_invoice_pdf_with_http_info(id, opts) + data + end + + # Retrieve invoice as PDF + # Generates a PDF version for an invoice + # @param id [String] ID of the Invoice for that the PDF should be generated + # @param [Hash] opts the optional parameters + # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers + def download_invoice_pdf_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.download_invoice_pdf ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.download_invoice_pdf" + end + # resource path + local_var_path = '/invoices/{id}/pdf'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'File' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.download_invoice_pdf", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#download_invoice_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve invoice + # Retrieve an invoice, identified by the given `id` in the URL > 📘 Deleted Invoices > > This endpoint can be used to retrieve details on deleted invoices > that the list of invoices omits. + # @param id [String] ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + def get_invoice(id, opts = {}) + data, _status_code, _headers = get_invoice_with_http_info(id, opts) + data + end + + # Retrieve invoice + # Retrieve an invoice, identified by the given `id` in the URL > 📘 Deleted Invoices > > This endpoint can be used to retrieve details on deleted invoices > that the list of invoices omits. + # @param id [String] ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(CreateInvoice200Response, Integer, Hash)>] CreateInvoice200Response data, response status code and response headers + def get_invoice_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.get_invoice ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling InvoicesApi.get_invoice" + end + # resource path + local_var_path = '/invoices/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateInvoice200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.get_invoice", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#get_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List invoices + # Fetch a list of all invoices on your account. > 🚧 Deleted invoices are omitted > > The response does not include any previously deleted invoices. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of invoices. The returned invoices are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of invoices listed. The maximum and default value is 10. + # @return [ListInvoices200Response] + def list_invoices(opts = {}) + data, _status_code, _headers = list_invoices_with_http_info(opts) + data + end + + # List invoices + # Fetch a list of all invoices on your account. > 🚧 Deleted invoices are omitted > > The response does not include any previously deleted invoices. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of invoices. The returned invoices are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of invoices listed. The maximum and default value is 10. + # @return [Array<(ListInvoices200Response, Integer, Hash)>] ListInvoices200Response data, response status code and response headers + def list_invoices_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: InvoicesApi.list_invoices ...' + end + # resource path + local_var_path = '/invoices' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListInvoices200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"InvoicesApi.list_invoices", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: InvoicesApi#list_invoices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/members_api.rb b/lib/tremendous/api/members_api.rb new file mode 100644 index 0000000..da04438 --- /dev/null +++ b/lib/tremendous/api/members_api.rb @@ -0,0 +1,213 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class MembersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + 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 one of two roles that determine their permissions within the organization: 1. `MEMBER`: Limited permissions. Can view their own reward and order histories only. 2. `ADMIN`: Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization. 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 [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) + 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 one of two roles that determine their permissions within the organization: 1. `MEMBER`: Limited permissions. Can view their own reward and order histories only. 2. `ADMIN`: Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization. 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 [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 = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.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 MembersApi.create_member" + end + # resource path + local_var_path = '/members' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_member_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateMember200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"MembersApi.create_member", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#create_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve member + # @param id [String] ID of the member to retrieve + # @param [Hash] opts the optional parameters + # @return [GetMember200Response] + def get_member(id, opts = {}) + data, _status_code, _headers = get_member_with_http_info(id, opts) + data + end + + # Retrieve member + # @param id [String] ID of the member to retrieve + # @param [Hash] opts the optional parameters + # @return [Array<(GetMember200Response, Integer, Hash)>] GetMember200Response data, response status code and response headers + def get_member_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.get_member ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling MembersApi.get_member" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling MembersApi.get_member, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/members/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetMember200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"MembersApi.get_member", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#get_member\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List members + # To list members of a sub-organization [create an API key for that organization](/reference/post_organizations-id-create-api-key) first, then use the new API key in the list members request. + # @param [Hash] opts the optional parameters + # @return [ListMembers200Response] + def list_members(opts = {}) + data, _status_code, _headers = list_members_with_http_info(opts) + data + end + + # List members + # To list members of a sub-organization [create an API key for that organization](/reference/post_organizations-id-create-api-key) first, then use the new API key in the list members request. + # @param [Hash] opts the optional parameters + # @return [Array<(ListMembers200Response, Integer, Hash)>] ListMembers200Response data, response status code and response headers + def list_members_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MembersApi.list_members ...' + end + # resource path + local_var_path = '/members' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListMembers200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"MembersApi.list_members", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MembersApi#list_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/orders_api.rb b/lib/tremendous/api/orders_api.rb new file mode 100644 index 0000000..5abd132 --- /dev/null +++ b/lib/tremendous/api/orders_api.rb @@ -0,0 +1,369 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class OrdersApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Approve order + # 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] + def approve_order(id, opts = {}) + data, _status_code, _headers = approve_order_with_http_info(id, opts) + data + end + + # Approve order + # 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 + def approve_order_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.approve_order ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.approve_order" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling OrdersApi.approve_order, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/order_approvals/{id}/approve'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateOrder201Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrdersApi.approve_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#approve_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + 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

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. + # @param create_order_request [CreateOrderRequest] Order to create + # @param [Hash] opts the optional parameters + # @return [CreateOrder200Response] + 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> </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. + # @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 + def create_order_with_http_info(create_order_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.create_order ...' + end + # verify the required parameter 'create_order_request' is set + if @api_client.config.client_side_validation && create_order_request.nil? + fail ArgumentError, "Missing the required parameter 'create_order_request' when calling OrdersApi.create_order" + end + # resource path + local_var_path = '/orders' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_order_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateOrder200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrdersApi.create_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#create_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve order + # 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] + def get_order(id, opts = {}) + data, _status_code, _headers = get_order_with_http_info(id, opts) + data + end + + # Retrieve order + # 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 + def get_order_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.get_order ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.get_order" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling OrdersApi.get_order, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/orders/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateOrder201Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrdersApi.get_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#get_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List orders + # Retrieve a list of orders + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of orders. The returned orders are ordered (and offsetted) by their creation date (DESC). + # @option opts [String] :campaign_id Only return results with a matching campaign_id. + # @option opts [String] :external_id Only return results with a matching external_id. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [Integer] :limit Limits the number of orders listed. The maximum value is 100 and the default is 10. + # @return [ListOrders200Response] + def list_orders(opts = {}) + data, _status_code, _headers = list_orders_with_http_info(opts) + data + end + + # List orders + # Retrieve a list of orders + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of orders. The returned orders are ordered (and offsetted) by their creation date (DESC). + # @option opts [String] :campaign_id Only return results with a matching campaign_id. + # @option opts [String] :external_id Only return results with a matching external_id. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [Integer] :limit Limits the number of orders listed. The maximum value is 100 and the default is 10. + # @return [Array<(ListOrders200Response, Integer, Hash)>] ListOrders200Response data, response status code and response headers + def list_orders_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.list_orders ...' + end + # resource path + local_var_path = '/orders' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + query_params[:'campaign_id'] = opts[:'campaign_id'] if !opts[:'campaign_id'].nil? + query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil? + query_params[:'created_at[gte]'] = opts[:'created_at_gte'] if !opts[:'created_at_gte'].nil? + query_params[:'created_at[lte]'] = opts[:'created_at_lte'] if !opts[:'created_at_lte'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListOrders200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrdersApi.list_orders", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#list_orders\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Reject order + # 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] + def reject_order(id, opts = {}) + data, _status_code, _headers = reject_order_with_http_info(id, opts) + data + end + + # Reject order + # 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 + def reject_order_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrdersApi.reject_order ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrdersApi.reject_order" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling OrdersApi.reject_order, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/order_approvals/{id}/reject'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateOrder201Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrdersApi.reject_order", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrdersApi#reject_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/organizations_api.rb b/lib/tremendous/api/organizations_api.rb new file mode 100644 index 0000000..86e4c75 --- /dev/null +++ b/lib/tremendous/api/organizations_api.rb @@ -0,0 +1,270 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class OrganizationsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Create API key + # Creates a new API key. The API key used to make the request will remain active. Created API keys are generated randomly and returned in the response. **You cannot retrieve them again.** + # @param [Hash] opts the optional parameters + # @return [CreateApiKey200Response] + def create_api_key(opts = {}) + data, _status_code, _headers = create_api_key_with_http_info(opts) + data + end + + # Create API key + # Creates a new API key. The API key used to make the request will remain active. Created API keys are generated randomly and returned in the response. **You cannot retrieve them again.** + # @param [Hash] opts the optional parameters + # @return [Array<(CreateApiKey200Response, Integer, Hash)>] CreateApiKey200Response data, response status code and response headers + def create_api_key_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsApi.create_api_key ...' + end + # resource path + local_var_path = '/organizations/create_api_key' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateApiKey200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrganizationsApi.create_api_key", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsApi#create_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + 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 [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) + 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 [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 = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsApi.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 OrganizationsApi.create_organization" + end + # resource path + local_var_path = '/organizations' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_organization_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateOrganization200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrganizationsApi.create_organization", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsApi#create_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve organization + # @param id [String] ID of the organization to retrieve + # @param [Hash] opts the optional parameters + # @return [GetOrganization200Response] + def get_organization(id, opts = {}) + data, _status_code, _headers = get_organization_with_http_info(id, opts) + data + end + + # Retrieve organization + # @param id [String] ID of the organization to retrieve + # @param [Hash] opts the optional parameters + # @return [Array<(GetOrganization200Response, Integer, Hash)>] GetOrganization200Response data, response status code and response headers + def get_organization_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsApi.get_organization ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling OrganizationsApi.get_organization" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling OrganizationsApi.get_organization, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/organizations/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetOrganization200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrganizationsApi.get_organization", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsApi#get_organization\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List organizations + # The returned list only includes the organization to which the API key belongs to, that is used for the request. + # @param [Hash] opts the optional parameters + # @return [ListOrganizations200Response] + def list_organizations(opts = {}) + data, _status_code, _headers = list_organizations_with_http_info(opts) + data + end + + # List organizations + # The returned list only includes the organization to which the API key belongs to, that is used for the request. + # @param [Hash] opts the optional parameters + # @return [Array<(ListOrganizations200Response, Integer, Hash)>] ListOrganizations200Response data, response status code and response headers + def list_organizations_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: OrganizationsApi.list_organizations ...' + end + # resource path + local_var_path = '/organizations' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListOrganizations200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"OrganizationsApi.list_organizations", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: OrganizationsApi#list_organizations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/products_api.rb b/lib/tremendous/api/products_api.rb new file mode 100644 index 0000000..5c8568a --- /dev/null +++ b/lib/tremendous/api/products_api.rb @@ -0,0 +1,153 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class ProductsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Retrieve product + # Retrieve a product, identified by the given `id` in the URL + # @param id [String] ID of the product that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetProduct200Response] + def get_product(id, opts = {}) + data, _status_code, _headers = get_product_with_http_info(id, opts) + data + end + + # Retrieve product + # Retrieve a product, identified by the given `id` in the URL + # @param id [String] ID of the product that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(GetProduct200Response, Integer, Hash)>] GetProduct200Response data, response status code and response headers + def get_product_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductsApi.get_product ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling ProductsApi.get_product" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling ProductsApi.get_product, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/products/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetProduct200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"ProductsApi.get_product", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductsApi#get_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List products + # Retrieve a list of available products + # @param [Hash] opts the optional parameters + # @option opts [String] :country Comma-separated list of [Alpha-2 country codes](https://www.iban.com/country-codes), used to only retrieve products available in the provided countries + # @option opts [String] :currency Comma-separated list of [currency codes](https://www.iban.com/currency-codes), used to only retrieve products available in the provided currencies + # @return [ListProducts200Response] + def list_products(opts = {}) + data, _status_code, _headers = list_products_with_http_info(opts) + data + end + + # List products + # Retrieve a list of available products + # @param [Hash] opts the optional parameters + # @option opts [String] :country Comma-separated list of [Alpha-2 country codes](https://www.iban.com/country-codes), used to only retrieve products available in the provided countries + # @option opts [String] :currency Comma-separated list of [currency codes](https://www.iban.com/currency-codes), used to only retrieve products available in the provided currencies + # @return [Array<(ListProducts200Response, Integer, Hash)>] ListProducts200Response data, response status code and response headers + def list_products_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductsApi.list_products ...' + end + # resource path + local_var_path = '/products' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'country'] = opts[:'country'] if !opts[:'country'].nil? + query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListProducts200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"ProductsApi.list_products", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductsApi#list_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/rewards_api.rb b/lib/tremendous/api/rewards_api.rb new file mode 100644 index 0000000..8763630 --- /dev/null +++ b/lib/tremendous/api/rewards_api.rb @@ -0,0 +1,354 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class RewardsApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Generate a reward URL + # Generate a redemption link for the reward identified by the `id` in the URL + # @param id [String] ID of the reward + # @param [Hash] opts the optional parameters + # @return [GenerateRewardLink200Response] + def generate_reward_link(id, opts = {}) + data, _status_code, _headers = generate_reward_link_with_http_info(id, opts) + data + end + + # Generate a reward URL + # Generate a redemption link for the reward identified by the `id` in the URL + # @param id [String] ID of the reward + # @param [Hash] opts the optional parameters + # @return [Array<(GenerateRewardLink200Response, Integer, Hash)>] GenerateRewardLink200Response data, response status code and response headers + def generate_reward_link_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.generate_reward_link ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling RewardsApi.generate_reward_link" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling RewardsApi.generate_reward_link, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/rewards/{id}/generate_link'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GenerateRewardLink200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"RewardsApi.generate_reward_link", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#generate_reward_link\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Generate a reward token + # Generate a temporary reward token identified by the `id` in the URL. These tokens are needed to render a reward when using [Tremendous Embed](https://github.com/tremendous-rewards/embed/blob/master/docs/documentation.md). The token is valid for 24 hours. + # @param id [String] ID of the reward + # @param [Hash] opts the optional parameters + # @return [GenerateRewardToken200Response] + def generate_reward_token(id, opts = {}) + data, _status_code, _headers = generate_reward_token_with_http_info(id, opts) + data + end + + # Generate a reward token + # Generate a temporary reward token identified by the `id` in the URL. These tokens are needed to render a reward when using [Tremendous Embed](https://github.com/tremendous-rewards/embed/blob/master/docs/documentation.md). The token is valid for 24 hours. + # @param id [String] ID of the reward + # @param [Hash] opts the optional parameters + # @return [Array<(GenerateRewardToken200Response, Integer, Hash)>] GenerateRewardToken200Response data, response status code and response headers + def generate_reward_token_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.generate_reward_token ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling RewardsApi.generate_reward_token" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling RewardsApi.generate_reward_token, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/rewards/{id}/generate_embed_token'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GenerateRewardToken200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"RewardsApi.generate_reward_token", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#generate_reward_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve single reward + # Retrieve the reward, identified by the given `id` in the URL + # @param id [String] ID of the reward that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetReward200Response] + def get_reward(id, opts = {}) + data, _status_code, _headers = get_reward_with_http_info(id, opts) + data + end + + # Retrieve single reward + # Retrieve the reward, identified by the given `id` in the URL + # @param id [String] ID of the reward that should be retrieved + # @param [Hash] opts the optional parameters + # @return [Array<(GetReward200Response, Integer, Hash)>] GetReward200Response data, response status code and response headers + def get_reward_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.get_reward ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling RewardsApi.get_reward" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling RewardsApi.get_reward, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/rewards/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetReward200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"RewardsApi.get_reward", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#get_reward\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List rewards + # Retrieve a list of all created rewards + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of rewards. The returned rewards are ordered (and offsetted) by their creation date (DESC). + # @return [ListRewards200Response] + def list_rewards(opts = {}) + data, _status_code, _headers = list_rewards_with_http_info(opts) + data + end + + # List rewards + # Retrieve a list of all created rewards + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of rewards. The returned rewards are ordered (and offsetted) by their creation date (DESC). + # @return [Array<(ListRewards200Response, Integer, Hash)>] ListRewards200Response data, response status code and response headers + def list_rewards_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: RewardsApi.list_rewards ...' + end + # resource path + local_var_path = '/rewards' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListRewards200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"RewardsApi.list_rewards", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#list_rewards\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resend reward + # 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 + # @return [Object] + def resend_reward(id, opts = {}) + data, _status_code, _headers = resend_reward_with_http_info(id, opts) + data + end + + # Resend reward + # 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 + # @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 + @api_client.config.logger.debug 'Calling API: RewardsApi.resend_reward ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling RewardsApi.resend_reward" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling RewardsApi.resend_reward, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/rewards/{id}/resend'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Object' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"RewardsApi.resend_reward", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: RewardsApi#resend_reward\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api/webhooks_api.rb b/lib/tremendous/api/webhooks_api.rb new file mode 100644 index 0000000..7a407d3 --- /dev/null +++ b/lib/tremendous/api/webhooks_api.rb @@ -0,0 +1,362 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'cgi' + +module Tremendous + class WebhooksApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + 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 + # @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) + 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 + # @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 = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.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 WebhooksApi.create_webhook" + end + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(create_webhook_request) + + # return_type + return_type = opts[:debug_return_type] || 'CreateWebhook200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"WebhooksApi.create_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Retrieve webhook + # > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to retrieve + # @param [Hash] opts the optional parameters + # @return [CreateWebhook200Response] + def get_webhook(id, opts = {}) + data, _status_code, _headers = get_webhook_with_http_info(id, opts) + data + end + + # Retrieve webhook + # > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to retrieve + # @param [Hash] opts the optional parameters + # @return [Array<(CreateWebhook200Response, Integer, Hash)>] CreateWebhook200Response data, response status code and response headers + def get_webhook_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling WebhooksApi.get_webhook, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/webhooks/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'CreateWebhook200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"WebhooksApi.get_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List events + # Lists all event types that can be sent to the configured webhook endpoint. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to list the events for + # @param [Hash] opts the optional parameters + # @return [ListWebhookEvents200Response] + def list_webhook_events(id, opts = {}) + data, _status_code, _headers = list_webhook_events_with_http_info(id, opts) + data + end + + # List events + # Lists all event types that can be sent to the configured webhook endpoint. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to list the events for + # @param [Hash] opts the optional parameters + # @return [Array<(ListWebhookEvents200Response, Integer, Hash)>] ListWebhookEvents200Response data, response status code and response headers + def list_webhook_events_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhook_events ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.list_webhook_events" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling WebhooksApi.list_webhook_events, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/webhooks/{id}/events'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListWebhookEvents200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"WebhooksApi.list_webhook_events", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#list_webhook_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List webhooks + # Every organization can only have one webhook. This endpoint shows the details about that webhook. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param [Hash] opts the optional parameters + # @return [ListWebhooks200Response] + def list_webhooks(opts = {}) + data, _status_code, _headers = list_webhooks_with_http_info(opts) + data + end + + # List webhooks + # Every organization can only have one webhook. This endpoint shows the details about that webhook. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param [Hash] opts the optional parameters + # @return [Array<(ListWebhooks200Response, Integer, Hash)>] ListWebhooks200Response data, response status code and response headers + def list_webhooks_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...' + end + # resource path + local_var_path = '/webhooks' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ListWebhooks200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"WebhooksApi.list_webhooks", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Test webhook + # Making a request to this endpoint will cause our system to trigger a webhook for the specified event. This can be very useful when testing the setup that processes webhooks on your end. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to test + # @param simulate_webhook_request [SimulateWebhookRequest] Webhook details + # @param [Hash] opts the optional parameters + # @return [String] + def simulate_webhook(id, simulate_webhook_request, opts = {}) + data, _status_code, _headers = simulate_webhook_with_http_info(id, simulate_webhook_request, opts) + data + end + + # Test webhook + # Making a request to this endpoint will cause our system to trigger a webhook for the specified event. This can be very useful when testing the setup that processes webhooks on your end. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id [String] ID of the webhook to test + # @param simulate_webhook_request [SimulateWebhookRequest] Webhook details + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def simulate_webhook_with_http_info(id, simulate_webhook_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: WebhooksApi.simulate_webhook ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.simulate_webhook" + end + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if @api_client.config.client_side_validation && id !~ pattern + fail ArgumentError, "invalid value for 'id' when calling WebhooksApi.simulate_webhook, must conform to the pattern #{pattern}." + end + + # verify the required parameter 'simulate_webhook_request' is set + if @api_client.config.client_side_validation && simulate_webhook_request.nil? + fail ArgumentError, "Missing the required parameter 'simulate_webhook_request' when calling WebhooksApi.simulate_webhook" + end + # resource path + local_var_path = '/webhooks/{id}/simulate'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['text/html', 'application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(simulate_webhook_request) + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || ['BearerApiKey'] + + new_options = opts.merge( + :operation => :"WebhooksApi.simulate_webhook", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: WebhooksApi#simulate_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/tremendous/api_client.rb b/lib/tremendous/api_client.rb new file mode 100644 index 0000000..052b28d --- /dev/null +++ b/lib/tremendous/api_client.rb @@ -0,0 +1,431 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'faraday' +require 'faraday/multipart' if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') + + +module Tremendous + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "OpenAPI-Generator/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + stream = nil + begin + response = connection(opts).public_send(http_method.to_sym.downcase) do |req| + request = build_request(http_method, path, req, opts) + stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary' + end + + if config.debugging + config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.status == 0 && response.respond_to?(:return_message) + # Errors from libcurl will be made visible here + fail ApiError.new(code: 0, + message: response.return_message) + else + fail ApiError.new(code: response.status, + response_headers: response.headers, + response_body: response.body), + response.reason_phrase + end + end + rescue Faraday::TimeoutError + fail ApiError.new('Connection timed out') + rescue Faraday::ConnectionFailed + fail ApiError.new('Connection failed') + end + + if opts[:return_type] == 'File' || opts[:return_type] == 'Binary' + data = deserialize_file(response, stream) + elsif opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.status, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Faraday::Request] A Faraday Request + def build_request(http_method, path, request, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + if config.debugging + config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + request.headers = header_params + request.body = req_body + + # Overload default options only if provided + request.options.params_encoder = config.params_encoder if config.params_encoder + request.options.timeout = config.timeout if config.timeout + + request.url url + request.params = query_params + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' + data = URI.encode_www_form(form_params) + elsif header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Tempfile + # TODO hardcode to application/octet-stream, need better way to detect content type + data[key] = Faraday::FilePart.new(value.path, 'application/octet-stream', value.path) + when ::Array, nil + # let Faraday handle Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + def download_file(request) + stream = [] + + # handle streaming Responses + request.options.on_data = Proc.new do |chunk, overall_received_bytes| + stream << chunk + end + stream + end + + def deserialize_file(response, stream) + body = response.body + if @config.return_binary_data == true + # return byte stream + encoding = body.encoding + stream.join.force_encoding(encoding) + else + # return file instead of binary data + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + tempfile.write(stream.join.force_encoding(encoding)) + tempfile.close + config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + tempfile + end + end + + def connection(opts) + opts[:header_params]['Content-Type'] == 'multipart/form-data' ? connection_multipart : connection_regular + end + + def connection_multipart + @connection_multipart ||= build_connection do |conn| + conn.request :multipart + conn.request :url_encoded + end + end + + def connection_regular + @connection_regular ||= build_connection + end + + def build_connection + Faraday.new(url: config.base_url, ssl: ssl_options, proxy: config.proxy) do |conn| + basic_auth(conn) + config.configure_middleware(conn) + yield(conn) if block_given? + conn.adapter(Faraday.default_adapter) + config.configure_connection(conn) + end + end + + def ssl_options + { + ca_file: config.ssl_ca_file, + verify: config.ssl_verify, + verify_mode: config.ssl_verify_mode, + client_cert: config.ssl_client_cert, + client_key: config.ssl_client_key + } + end + + def basic_auth(conn) + if config.username && config.password + if Gem::Version.new(Faraday::VERSION) >= Gem::Version.new('2.0') + conn.request(:authorization, :basic, config.username, config.password) + else + conn.request(:basic_auth, config.username, config.password) + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body.to_s if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = Tremendous.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update header and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # return nil by default + return if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/tremendous/api_error.rb b/lib/tremendous/api_error.rb new file mode 100644 index 0000000..368ae74 --- /dev/null +++ b/lib/tremendous/api_error.rb @@ -0,0 +1,58 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +module Tremendous + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + @message = arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/tremendous/configuration.rb b/lib/tremendous/configuration.rb new file mode 100644 index 0000000..bd4e72d --- /dev/null +++ b/lib/tremendous/configuration.rb @@ -0,0 +1,386 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +module Tremendous + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # Defines API keys used with API Key authentications. + # + # @return [Hash] key: parameter name, value: parameter value (API key) + # + # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string) + # config.api_key['api_key'] = 'xxx' + attr_accessor :api_key + + # Defines API key prefixes used with API Key authentications. + # + # @return [Hash] key: parameter name, value: API key prefix + # + # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers) + # config.api_key_prefix['api_key'] = 'Token' + attr_accessor :api_key_prefix + + # Defines the username used with HTTP basic authentication. + # + # @return [String] + attr_accessor :username + + # Defines the password used with HTTP basic authentication. + # + # @return [String] + attr_accessor :password + + # Defines the access token (Bearer) used with OAuth2. + attr_accessor :access_token + + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :ssl_verify + + ### TLS/SSL setting + # Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html) + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + attr_accessor :ssl_verify_mode + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + attr_accessor :ssl_ca_file + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :ssl_client_cert + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :ssl_client_key + + ### Proxy setting + # HTTP Proxy settings + attr_accessor :proxy + + # Set this to customize parameters encoder of array parameter. + # Default to nil. Faraday uses NestedParamsEncoder when nil. + # + # @see The params_encoder option of Faraday. Related source code: + # https://github.com/lostisland/faraday/tree/main/lib/faraday/encoders + attr_accessor :params_encoder + + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'testflight.tremendous.com' + @base_path = '/api/v2' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @api_key = {} + @api_key_prefix = {} + @client_side_validation = true + @ssl_verify = true + @ssl_verify_mode = nil + @ssl_ca_file = nil + @ssl_client_cert = nil + @ssl_client_key = nil + @middlewares = Hash.new { |h, k| h[k] = [] } + @configure_connection_blocks = [] + @timeout = 60 + # return data as binary instead of file + @return_binary_data = false + @params_encoder = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end + end + + # Gets API key (with prefix if set). + # @param [String] param_name the parameter name of API key auth + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? + if @api_key_prefix[param_name] + "#{@api_key_prefix[param_name]} #{key}" + else + key + end + end + + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + + # Gets Basic Auth token string + def basic_auth_token + 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'BearerApiKey' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer #{access_token_with_refresh}" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://testflight.tremendous.com/api/v2", + description: "Sandbox environment", + }, + { + url: "https://www.tremendous.com/api/v2", + description: "Production environment", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + # Configure Faraday connection directly. + # + # ``` + # c.configure_faraday_connection do |conn| + # conn.use Faraday::HttpCache, shared_cache: false, logger: logger + # conn.response :logger, nil, headers: true, bodies: true, log_level: :debug do |logger| + # logger.filter(/(Authorization: )(.*)/, '\1[REDACTED]') + # end + # end + # + # c.configure_faraday_connection do |conn| + # conn.adapter :typhoeus + # end + # ``` + # + # @param block [Proc] `#call`able object that takes one arg, the connection + def configure_faraday_connection(&block) + @configure_connection_blocks << block + end + + def configure_connection(conn) + @configure_connection_blocks.each do |block| + block.call(conn) + end + end + + # Adds middleware to the stack + def use(*middleware) + set_faraday_middleware(:use, *middleware) + end + + # Adds request middleware to the stack + def request(*middleware) + set_faraday_middleware(:request, *middleware) + end + + # Adds response middleware to the stack + def response(*middleware) + set_faraday_middleware(:response, *middleware) + end + + # Adds Faraday middleware setting information to the stack + # + # @example Use the `set_faraday_middleware` method to set middleware information + # config.set_faraday_middleware(:request, :retry, max: 3, methods: [:get, :post], retry_statuses: [503]) + # config.set_faraday_middleware(:response, :logger, nil, { bodies: true, log_level: :debug }) + # config.set_faraday_middleware(:use, Faraday::HttpCache, store: Rails.cache, shared_cache: false) + # config.set_faraday_middleware(:insert, 0, FaradayMiddleware::FollowRedirects, { standards_compliant: true, limit: 1 }) + # config.set_faraday_middleware(:swap, 0, Faraday::Response::Logger) + # config.set_faraday_middleware(:delete, Faraday::Multipart::Middleware) + # + # @see https://github.com/lostisland/faraday/blob/v2.3.0/lib/faraday/rack_builder.rb#L92-L143 + def set_faraday_middleware(operation, key, *args, &block) + unless [:request, :response, :use, :insert, :insert_before, :insert_after, :swap, :delete].include?(operation) + fail ArgumentError, "Invalid faraday middleware operation #{operation}. Must be" \ + " :request, :response, :use, :insert, :insert_before, :insert_after, :swap or :delete." + end + + @middlewares[operation] << [key, args, block] + end + ruby2_keywords(:set_faraday_middleware) if respond_to?(:ruby2_keywords, true) + + # Set up middleware on the connection + def configure_middleware(connection) + return if @middlewares.empty? + + [:request, :response, :use, :insert, :insert_before, :insert_after, :swap].each do |operation| + next unless @middlewares.key?(operation) + + @middlewares[operation].each do |key, args, block| + connection.builder.send(operation, key, *args, &block) + end + end + + if @middlewares.key?(:delete) + @middlewares[:delete].each do |key, _args, _block| + connection.builder.delete(key) + end + end + end + + end +end diff --git a/lib/tremendous/models/balance_transaction.rb b/lib/tremendous/models/balance_transaction.rb new file mode 100644 index 0000000..493cceb --- /dev/null +++ b/lib/tremendous/models/balance_transaction.rb @@ -0,0 +1,256 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # A balance transaction represents a specific movement or change in an account's balance. + class BalanceTransaction + # Date that the transaction was created + attr_accessor :created_at + + # Amount of the transaction in USD + attr_accessor :amount + + # The updated total after the transaction. Note that this running balance may be delayed and contain `null`. + attr_accessor :balance + + # The action that was performed + attr_accessor :action + + # A brief description of the transaction + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'amount' => :'amount', + :'balance' => :'balance', + :'action' => :'action', + :'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 + { + :'created_at' => :'Date', + :'amount' => :'Float', + :'balance' => :'Float', + :'action' => :'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::BalanceTransaction` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::BalanceTransaction`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + 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 && + created_at == o.created_at && + amount == o.amount && + balance == o.balance && + action == o.action && + 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 + [created_at, amount, balance, action, 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/campaign.rb b/lib/tremendous/models/campaign.rb new file mode 100644 index 0000000..b6e9ecd --- /dev/null +++ b/lib/tremendous/models/campaign.rb @@ -0,0 +1,292 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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. > Note: Campaigns must be created from the Tremendous dashboard. > > • [Production Dashboard](https://app.tremendous.com) > • [Sandbox Dashboard](https://app.testflight.tremendous.com/) + class Campaign + attr_accessor :id + + # Name of the campaign + attr_accessor :name + + # Description of the campaign + attr_accessor :description + + # List of IDs of products (different gift cards, charity, etc.) that are available in this campaign. + attr_accessor :products + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'products' => :'products' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'products' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Campaign` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Campaign`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + 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 + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + 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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @products.nil? + 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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + products == o.products + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, products].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_api_key200_response.rb b/lib/tremendous/models/create_api_key200_response.rb new file mode 100644 index 0000000..7ca1706 --- /dev/null +++ b/lib/tremendous/models/create_api_key200_response.rb @@ -0,0 +1,215 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateApiKey200Response + # The new API key + attr_accessor :api_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'api_key' => :'api_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'api_key' => :'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::CreateApiKey200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateApiKey200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'api_key') + self.api_key = attributes[:'api_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + api_key == o.api_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [api_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_invoice.rb b/lib/tremendous/models/create_invoice.rb new file mode 100644 index 0000000..315798f --- /dev/null +++ b/lib/tremendous/models/create_invoice.rb @@ -0,0 +1,244 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateInvoice + # Reference to the purchase order number within your organization + attr_accessor :po_number + + # Amount of the invoice in USD + attr_accessor :amount + + # A note to be included in the invoice. This is for your internal use and will not be visible to the recipient. + attr_accessor :memo + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'po_number' => :'po_number', + :'amount' => :'amount', + :'memo' => :'memo' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'po_number' => :'String', + :'amount' => :'Float', + :'memo' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'po_number', + :'memo' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes 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::CreateInvoice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateInvoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'po_number') + self.po_number = attributes[:'po_number'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + else + self.amount = nil + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @amount.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + po_number == o.po_number && + amount == o.amount && + memo == o.memo + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [po_number, amount, memo].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_invoice200_response.rb b/lib/tremendous/models/create_invoice200_response.rb new file mode 100644 index 0000000..b0a19b1 --- /dev/null +++ b/lib/tremendous/models/create_invoice200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateInvoice200Response + attr_accessor :invoice + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'invoice' => :'invoice' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'invoice' => :'ListInvoices200ResponseInvoicesInner' + } + 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::CreateInvoice200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateInvoice200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'invoice') + self.invoice = attributes[:'invoice'] + else + self.invoice = 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 @invoice.nil? + invalid_properties.push('invalid value for "invoice", invoice 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 @invoice.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 && + invoice == o.invoice + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [invoice].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_invoice_request.rb b/lib/tremendous/models/create_invoice_request.rb new file mode 100644 index 0000000..0d4c533 --- /dev/null +++ b/lib/tremendous/models/create_invoice_request.rb @@ -0,0 +1,244 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateInvoiceRequest + # Reference to the purchase order number within your organization + attr_accessor :po_number + + # Amount of the invoice in USD + attr_accessor :amount + + # A note to be included in the invoice. This is for your internal use and will not be visible to the recipient. + attr_accessor :memo + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'po_number' => :'po_number', + :'amount' => :'amount', + :'memo' => :'memo' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'po_number' => :'String', + :'amount' => :'Float', + :'memo' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'po_number', + :'memo' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes 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::CreateInvoiceRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateInvoiceRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'po_number') + self.po_number = attributes[:'po_number'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + else + self.amount = nil + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @amount.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + po_number == o.po_number && + amount == o.amount && + memo == o.memo + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [po_number, amount, memo].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_member.rb b/lib/tremendous/models/create_member.rb new file mode 100644 index 0000000..f610b65 --- /dev/null +++ b/lib/tremendous/models/create_member.rb @@ -0,0 +1,290 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateMember + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
+ attr_accessor :role + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'name' => :'name', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'name' => :'String', + :'role' => :'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::CreateMember` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = 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 @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role 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 @email.nil? + return false if @name.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + return false unless role_validator.valid?(@role) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + name == o.name && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, name, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_member200_response.rb b/lib/tremendous/models/create_member200_response.rb new file mode 100644 index 0000000..b588d1c --- /dev/null +++ b/lib/tremendous/models/create_member200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateMember200Response + attr_accessor :member + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'member' => :'member' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'member' => :'ListMembers200ResponseMembersInner' + } + 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::CreateMember200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateMember200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'member') + self.member = attributes[:'member'] + else + self.member = 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 @member.nil? + invalid_properties.push('invalid value for "member", member 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 @member.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 && + member == o.member + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [member].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_member_request.rb b/lib/tremendous/models/create_member_request.rb new file mode 100644 index 0000000..fa04f0a --- /dev/null +++ b/lib/tremendous/models/create_member_request.rb @@ -0,0 +1,290 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateMemberRequest + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
+ attr_accessor :role + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'email' => :'email', + :'name' => :'name', + :'role' => :'role' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'email' => :'String', + :'name' => :'String', + :'role' => :'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::CreateMemberRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateMemberRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = 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 @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role 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 @email.nil? + return false if @name.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + return false unless role_validator.valid?(@role) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + name == o.name && + role == o.role + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [email, name, role].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_order200_response.rb b/lib/tremendous/models/create_order200_response.rb new file mode 100644 index 0000000..5e41a72 --- /dev/null +++ b/lib/tremendous/models/create_order200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrder200Response + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'CreateOrder200ResponseOrder' + } + 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::CreateOrder200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrder200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + else + self.order = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @order.nil? + invalid_properties.push('invalid value for "order", order cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @order.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 && + order == o.order + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_order200_response_order.rb b/lib/tremendous/models/create_order200_response_order.rb new file mode 100644 index 0000000..ff14d02 --- /dev/null +++ b/lib/tremendous/models/create_order200_response_order.rb @@ -0,0 +1,400 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # An order wraps around the fulfilment of one or more rewards. + class CreateOrder200ResponseOrder + # 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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + attr_accessor :rewards + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id', + :'rewards' => :'rewards' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'ListOrders200ResponseOrdersInnerPayment', + :'invoice_id' => :'String', + :'rewards' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrder200ResponseOrder` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrder200ResponseOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'rewards') + if (value = attributes[:'rewards']).is_a?(Array) + self.rewards = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if !@rewards.nil? && @rewards.length < 1 + invalid_properties.push('invalid value for "rewards", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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"]) + return false unless status_validator.valid?(@status) + return false if !@rewards.nil? && @rewards.length < 1 + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + 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 with validation + # @param [Object] rewards Value to be assigned + def rewards=(rewards) + if rewards.nil? + fail ArgumentError, 'rewards cannot be nil' + end + + if rewards.length < 1 + fail ArgumentError, 'invalid value for "rewards", number of items must be greater than or equal to 1.' + end + + @rewards = rewards + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id && + rewards == o.rewards + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_id, rewards].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_order200_response_order_rewards_inner.rb b/lib/tremendous/models/create_order200_response_order_rewards_inner.rb new file mode 100644 index 0000000..c732677 --- /dev/null +++ b/lib/tremendous/models/create_order200_response_order_rewards_inner.rb @@ -0,0 +1,347 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 CreateOrder200ResponseOrderRewardsInner + # 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 + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'CreateOrder200ResponseOrderRewardsInnerDelivery' + } + 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::CreateOrder200ResponseOrderRewardsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrder200ResponseOrderRewardsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_id\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_order200_response_order_rewards_inner_delivery.rb b/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb new file mode 100644 index 0000000..7c292e2 --- /dev/null +++ b/lib/tremendous/models/create_order200_response_order_rewards_inner_delivery.rb @@ -0,0 +1,296 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class CreateOrder200ResponseOrderRewardsInnerDelivery + # 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. Only available for rewards for which the `method` for delivery is set to `LINK`. + attr_accessor :link + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status', + :'link' => :'link' + } + end + + # 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' => :'String', + :'status' => :'String', + :'link' => :'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::CreateOrder200ResponseOrderRewardsInnerDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrder200ResponseOrderRewardsInnerDelivery`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status && + link == o.link + end + + # @see the `==` method + # @param [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, status, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_order201_response.rb b/lib/tremendous/models/create_order201_response.rb new file mode 100644 index 0000000..7df6f75 --- /dev/null +++ b/lib/tremendous/models/create_order201_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrder201Response + attr_accessor :order + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'order' => :'order' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'order' => :'ListOrders200ResponseOrdersInner' + } + 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::CreateOrder201Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrder201Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'order') + self.order = attributes[:'order'] + else + self.order = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @order.nil? + invalid_properties.push('invalid value for "order", order cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @order.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 && + order == o.order + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [order].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_order_request.rb b/lib/tremendous/models/create_order_request.rb new file mode 100644 index 0000000..97b7aca --- /dev/null +++ b/lib/tremendous/models/create_order_request.rb @@ -0,0 +1,248 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrderRequest + # 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 + + attr_accessor :payment + + attr_accessor :reward + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'external_id' => :'external_id', + :'payment' => :'payment', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'external_id' => :'String', + :'payment' => :'CreateOrderRequestPayment', + :'reward' => :'CreateOrderRequestReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrderRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + else + self.payment = nil + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + else + self.reward = 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 @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 + + invalid_properties + end + + # Check to see if the 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 @payment.nil? + return false if @reward.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 && + external_id == o.external_id && + payment == o.payment && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [external_id, payment, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_order_request_payment.rb b/lib/tremendous/models/create_order_request_payment.rb new file mode 100644 index 0000000..e0a01ec --- /dev/null +++ b/lib/tremendous/models/create_order_request_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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrderRequestPayment + # 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::CreateOrderRequestPayment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrderRequestPayment`. Please check the name 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/create_order_request_reward.rb b/lib/tremendous/models/create_order_request_reward.rb new file mode 100644 index 0000000..8b862b7 --- /dev/null +++ b/lib/tremendous/models/create_order_request_reward.rb @@ -0,0 +1,344 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 CreateOrderRequestReward + # 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + # Set this to translate the redemption experience for this reward. Pass a 2-letter [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the desired language. Defaults to `en`. + attr_accessor :language + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'language' => :'language', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'language' => :'String', + :'delivery' => :'CreateOrderRequestRewardDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateOrderRequestReward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrderRequestReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@campaign_id.nil? && @campaign_id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + true + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + language == o.language && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_order_request_reward_delivery.rb b/lib/tremendous/models/create_order_request_reward_delivery.rb new file mode 100644 index 0000000..5881720 --- /dev/null +++ b/lib/tremendous/models/create_order_request_reward_delivery.rb @@ -0,0 +1,250 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class CreateOrderRequestRewardDelivery + # 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 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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' => :'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::CreateOrderRequestRewardDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrderRequestRewardDelivery`. Please check the name 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' + method_validator = EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + return false unless method_validator.valid?(@method) + 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 + + # 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/create_organization.rb b/lib/tremendous/models/create_organization.rb new file mode 100644 index 0000000..80ac119 --- /dev/null +++ b/lib/tremendous/models/create_organization.rb @@ -0,0 +1,268 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrganization + # Name of the organization + attr_accessor :name + + # 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 +). + attr_accessor :phone + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'website' => :'website', + :'with_api_key' => :'with_api_key', + :'copy_settings' => :'copy_settings', + :'phone' => :'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 + { + :'name' => :'String', + :'website' => :'String', + :'with_api_key' => :'Boolean', + :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'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::CreateOrganization` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrganization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'website') + self.website = attributes[:'website'] + else + 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 + + if attributes.key?(:'phone') + self.phone = attributes[:'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 + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @website.nil? + invalid_properties.push('invalid value for "website", website 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 @name.nil? + return false if @website.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 && + name == o.name && + website == o.website && + with_api_key == o.with_api_key && + copy_settings == o.copy_settings && + phone == o.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 + [name, website, with_api_key, copy_settings, 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/create_organization200_response.rb b/lib/tremendous/models/create_organization200_response.rb new file mode 100644 index 0000000..1c79962 --- /dev/null +++ b/lib/tremendous/models/create_organization200_response.rb @@ -0,0 +1,214 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrganization200Response + attr_accessor :organization + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization' => :'organization' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'organization' => :'CreateOrganization200ResponseOrganization' + } + 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::CreateOrganization200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrganization200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'organization') + self.organization = attributes[:'organization'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + organization == o.organization + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [organization].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_organization200_response_organization.rb b/lib/tremendous/models/create_organization200_response_organization.rb new file mode 100644 index 0000000..8106fbe --- /dev/null +++ b/lib/tremendous/models/create_organization200_response_organization.rb @@ -0,0 +1,334 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Organizations are a way to separate different parts of your business within the same Tremendous account. Your root Tremendous account is an organization itself and can have multiple sub-organizations. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. Each organizations can have it's own API key. + class CreateOrganization200ResponseOrganization + attr_accessor :id + + # Name of the organization + attr_accessor :name + + # URL of the website of that organization + attr_accessor :website + + # Status of the organization. Organizations need to be approved to be able to use them to send out rewards. + attr_accessor :status + + # Timestamp of when the organization has been created. *This field is only returned when creating an organization.* It is not returned anymore when retrieving or listing organizations. + attr_accessor :created_at + + # The API key for the created organization. This property is only returned when `with_api_key` is set to `true`. + attr_accessor :api_key + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'website' => :'website', + :'status' => :'status', + :'created_at' => :'created_at', + :'api_key' => :'api_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'website' => :'String', + :'status' => :'String', + :'created_at' => :'Date', + :'api_key' => :'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::CreateOrganization200ResponseOrganization` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrganization200ResponseOrganization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'website') + self.website = attributes[:'website'] + else + self.website = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'api_key') + self.api_key = attributes[:'api_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @website.nil? + invalid_properties.push('invalid value for "website", website cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @website.nil? + status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + website == o.website && + status == o.status && + created_at == o.created_at && + api_key == o.api_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, website, status, created_at, api_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_request.rb b/lib/tremendous/models/create_organization_request.rb new file mode 100644 index 0000000..8e40e3c --- /dev/null +++ b/lib/tremendous/models/create_organization_request.rb @@ -0,0 +1,268 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateOrganizationRequest + # Name of the organization + attr_accessor :name + + # 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 +). + attr_accessor :phone + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'website' => :'website', + :'with_api_key' => :'with_api_key', + :'copy_settings' => :'copy_settings', + :'phone' => :'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 + { + :'name' => :'String', + :'website' => :'String', + :'with_api_key' => :'Boolean', + :'copy_settings' => :'CreateOrganizationRequestCopySettings', + :'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::CreateOrganizationRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrganizationRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'website') + self.website = attributes[:'website'] + else + 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 + + if attributes.key?(:'phone') + self.phone = attributes[:'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 + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @website.nil? + invalid_properties.push('invalid value for "website", website 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 @name.nil? + return false if @website.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 && + name == o.name && + website == o.website && + with_api_key == o.with_api_key && + copy_settings == o.copy_settings && + phone == o.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 + [name, website, with_api_key, copy_settings, 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/create_organization_request_copy_settings.rb b/lib/tremendous/models/create_organization_request_copy_settings.rb new file mode 100644 index 0000000..1af0235 --- /dev/null +++ b/lib/tremendous/models/create_organization_request_copy_settings.rb @@ -0,0 +1,278 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # A list of the settings that you wish to copy over to the new organization. + class CreateOrganizationRequestCopySettings + # 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 from the current organization to the new organization. Defaults to `false`. + attr_accessor :users + + # 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' + } + end + + # 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' + } + 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::CreateOrganizationRequestCopySettings` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateOrganizationRequestCopySettings`. Please check the name 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 + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # 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 + end + + # @see the `==` method + # @param [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].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_webhook200_response.rb b/lib/tremendous/models/create_webhook200_response.rb new file mode 100644 index 0000000..d3196e0 --- /dev/null +++ b/lib/tremendous/models/create_webhook200_response.rb @@ -0,0 +1,214 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateWebhook200Response + attr_accessor :webhook + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhook' => :'webhook' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhook' => :'ListWebhooks200ResponseWebhooksInner' + } + 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::CreateWebhook200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateWebhook200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhook') + self.webhook = attributes[:'webhook'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + webhook == o.webhook + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhook].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_webhook_request.rb b/lib/tremendous/models/create_webhook_request.rb new file mode 100644 index 0000000..ebaddc3 --- /dev/null +++ b/lib/tremendous/models/create_webhook_request.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CreateWebhookRequest + # URL the webhook will make requests to + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateWebhookRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CreateWebhookRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @url.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/currency_codes.rb b/lib/tremendous/models/currency_codes.rb new file mode 100644 index 0000000..f5d588f --- /dev/null +++ b/lib/tremendous/models/currency_codes.rb @@ -0,0 +1,154 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class CurrencyCodes + USD = "USD".freeze + CAD = "CAD".freeze + EUR = "EUR".freeze + AED = "AED".freeze + AFN = "AFN".freeze + ALL = "ALL".freeze + AMD = "AMD".freeze + ARS = "ARS".freeze + AUD = "AUD".freeze + AZN = "AZN".freeze + BAM = "BAM".freeze + BDT = "BDT".freeze + BGN = "BGN".freeze + BHD = "BHD".freeze + BIF = "BIF".freeze + BND = "BND".freeze + BOB = "BOB".freeze + BRL = "BRL".freeze + BWP = "BWP".freeze + BYR = "BYR".freeze + BZD = "BZD".freeze + CDF = "CDF".freeze + CHF = "CHF".freeze + CLP = "CLP".freeze + CNY = "CNY".freeze + COP = "COP".freeze + CRC = "CRC".freeze + CVE = "CVE".freeze + CZK = "CZK".freeze + DJF = "DJF".freeze + DKK = "DKK".freeze + DOP = "DOP".freeze + DZD = "DZD".freeze + EEK = "EEK".freeze + EGP = "EGP".freeze + ERN = "ERN".freeze + ETB = "ETB".freeze + GBP = "GBP".freeze + GEL = "GEL".freeze + GHS = "GHS".freeze + GNF = "GNF".freeze + GTQ = "GTQ".freeze + HKD = "HKD".freeze + HNL = "HNL".freeze + HRK = "HRK".freeze + HUF = "HUF".freeze + IDR = "IDR".freeze + ILS = "ILS".freeze + INR = "INR".freeze + IQD = "IQD".freeze + IRR = "IRR".freeze + ISK = "ISK".freeze + JMD = "JMD".freeze + JOD = "JOD".freeze + JPY = "JPY".freeze + KES = "KES".freeze + KHR = "KHR".freeze + KRW = "KRW".freeze + KWD = "KWD".freeze + KZT = "KZT".freeze + LBP = "LBP".freeze + LKR = "LKR".freeze + LTL = "LTL".freeze + LVL = "LVL".freeze + MAD = "MAD".freeze + MDL = "MDL".freeze + MGA = "MGA".freeze + MKD = "MKD".freeze + MMK = "MMK".freeze + MOP = "MOP".freeze + MUR = "MUR".freeze + MXN = "MXN".freeze + MYR = "MYR".freeze + MZN = "MZN".freeze + NAD = "NAD".freeze + NGN = "NGN".freeze + NIO = "NIO".freeze + NOK = "NOK".freeze + NPR = "NPR".freeze + NZD = "NZD".freeze + OMR = "OMR".freeze + PAB = "PAB".freeze + PEN = "PEN".freeze + PHP = "PHP".freeze + PKR = "PKR".freeze + PLN = "PLN".freeze + PYG = "PYG".freeze + QAR = "QAR".freeze + RON = "RON".freeze + RSD = "RSD".freeze + RUB = "RUB".freeze + RWF = "RWF".freeze + SAR = "SAR".freeze + SDG = "SDG".freeze + SEK = "SEK".freeze + SGD = "SGD".freeze + SOS = "SOS".freeze + SYP = "SYP".freeze + THB = "THB".freeze + TND = "TND".freeze + TOP = "TOP".freeze + TRY = "TRY".freeze + TTD = "TTD".freeze + TWD = "TWD".freeze + TZS = "TZS".freeze + UAH = "UAH".freeze + UGX = "UGX".freeze + UYU = "UYU".freeze + UZS = "UZS".freeze + VEF = "VEF".freeze + VND = "VND".freeze + XAF = "XAF".freeze + XOF = "XOF".freeze + YER = "YER".freeze + ZAR = "ZAR".freeze + ZMK = "ZMK".freeze + + def self.all_vars + @all_vars ||= [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].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if CurrencyCodes.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #CurrencyCodes" + end + end +end diff --git a/lib/tremendous/models/custom_field.rb b/lib/tremendous/models/custom_field.rb new file mode 100644 index 0000000..da9a5a4 --- /dev/null +++ b/lib/tremendous/models/custom_field.rb @@ -0,0 +1,248 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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 + attr_accessor :value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'value' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CustomField` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::CustomField`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/delivery_details.rb b/lib/tremendous/models/delivery_details.rb new file mode 100644 index 0000000..660b681 --- /dev/null +++ b/lib/tremendous/models/delivery_details.rb @@ -0,0 +1,286 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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 + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'method' => :'String', + :'status' => :'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::DeliveryDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::DeliveryDetails`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [method, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/delivery_details_with_link.rb b/lib/tremendous/models/delivery_details_with_link.rb new file mode 100644 index 0000000..6f287af --- /dev/null +++ b/lib/tremendous/models/delivery_details_with_link.rb @@ -0,0 +1,296 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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. Only available for rewards for which the `method` for delivery is set to `LINK`. + attr_accessor :link + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status', + :'link' => :'link' + } + end + + # 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' => :'String', + :'status' => :'String', + :'link' => :'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::DeliveryDetailsWithLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::DeliveryDetailsWithLink`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status && + link == o.link + end + + # @see the `==` method + # @param [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, status, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/delivery_method.rb b/lib/tremendous/models/delivery_method.rb new file mode 100644 index 0000000..7f3bb34 --- /dev/null +++ b/lib/tremendous/models/delivery_method.rb @@ -0,0 +1,41 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class DeliveryMethod + EMAIL = "EMAIL".freeze + LINK = "LINK".freeze + PHONE = "PHONE".freeze + + def self.all_vars + @all_vars ||= [EMAIL, LINK, PHONE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if DeliveryMethod.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #DeliveryMethod" + end + end +end diff --git a/lib/tremendous/models/delivery_status.rb b/lib/tremendous/models/delivery_status.rb new file mode 100644 index 0000000..c1de50a --- /dev/null +++ b/lib/tremendous/models/delivery_status.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class DeliveryStatus + SCHEDULED = "SCHEDULED".freeze + FAILED = "FAILED".freeze + SUCCEEDED = "SUCCEEDED".freeze + PENDING = "PENDING".freeze + + def self.all_vars + @all_vars ||= [SCHEDULED, FAILED, SUCCEEDED, PENDING].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if DeliveryStatus.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #DeliveryStatus" + end + end +end diff --git a/lib/tremendous/models/error_model.rb b/lib/tremendous/models/error_model.rb new file mode 100644 index 0000000..45888f4 --- /dev/null +++ b/lib/tremendous/models/error_model.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ErrorModel + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'errors' => :'ListRewards401ResponseErrors' + } + 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::ErrorModel` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ErrorModel`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + else + self.errors = 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 @errors.nil? + invalid_properties.push('invalid value for "errors", errors 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 @errors.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 && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/field.rb b/lib/tremendous/models/field.rb new file mode 100644 index 0000000..ab9bad7 --- /dev/null +++ b/lib/tremendous/models/field.rb @@ -0,0 +1,286 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class Field + attr_accessor :id + + # Label of the field + attr_accessor :label + + # Type of the values of the field + attr_accessor :data_type + + attr_accessor :data + + # Is this field required (true) or optional (false) + attr_accessor :required + + # Type of objects this field gets associated with + attr_accessor :scope + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'label' => :'label', + :'data_type' => :'data_type', + :'data' => :'data', + :'required' => :'required', + :'scope' => :'scope' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'label' => :'String', + :'data_type' => :'String', + :'data' => :'Hash', + :'required' => :'Boolean', + :'scope' => :'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::Field` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Field`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + + if attributes.key?(:'data_type') + self.data_type = attributes[:'data_type'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Hash) + self.data = value + end + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + label == o.label && + data_type == o.data_type && + data == o.data && + required == o.required && + scope == o.scope + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, label, data_type, data, required, scope].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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.rb b/lib/tremendous/models/funding_source.rb new file mode 100644 index 0000000..d4932f2 --- /dev/null +++ b/lib/tremendous/models/funding_source.rb @@ -0,0 +1,332 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # + class FundingSource + attr_accessor :id + + # You can pay for rewards using different payment methods on Tremendous:
Payment Method Description
balance Pre-funded balance in your Tremendous account to draw funds from to send rewards to recipients.
bank_account Bank account to draw funds from to send rewards to recipients.
credit_card Credit card to draw funds from to send rewards to recipients.
invoice Send rewards to recipients and pay by invoice.
+ attr_accessor :method + + # **Only available when `method` is set to `invoice`.** + attr_accessor :type + + attr_accessor :meta + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'method' => :'method', + :'type' => :'type', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'method' => :'String', + :'type' => :'String', + :'meta' => :'ListFundingSources200ResponseFundingSourcesInnerMeta' + } + 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::FundingSource` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::FundingSource`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + else + self.method = nil + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + else + self.meta = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + if @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @meta.nil? + invalid_properties.push('invalid value for "meta", meta cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @method.nil? + method_validator = EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + return false unless method_validator.valid?(@method) + type_validator = EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + return false unless type_validator.valid?(@type) + return false if @meta.nil? + 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 checking allowed values (enum). + # @param [Object] method Object to be assigned + def method=(method) + validator = EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + 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] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + method == o.method && + type == o.type && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, method, type, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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 new file mode 100644 index 0000000..5efad18 --- /dev/null +++ b/lib/tremendous/models/generate_reward_link200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GenerateRewardLink200Response + attr_accessor :reward + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reward' => :'GenerateRewardLink200ResponseReward' + } + 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::GenerateRewardLink200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GenerateRewardLink200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + else + self.reward = 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 @reward.nil? + invalid_properties.push('invalid value for "reward", reward 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 @reward.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 && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_reward.rb b/lib/tremendous/models/generate_reward_link200_response_reward.rb new file mode 100644 index 0000000..4ced352 --- /dev/null +++ b/lib/tremendous/models/generate_reward_link200_response_reward.rb @@ -0,0 +1,247 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # The redemption link for a reward. + class GenerateRewardLink200ResponseReward + # Tremendous ID of the reward + attr_accessor :id + + # Link to redeem the reward at. You need to deliver this link to the recipient. + attr_accessor :link + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'link' => :'link' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'link' => :'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::GenerateRewardLink200ResponseReward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GenerateRewardLink200ResponseReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + link == o.link + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_link403_response.rb b/lib/tremendous/models/generate_reward_link403_response.rb new file mode 100644 index 0000000..7fd57ea --- /dev/null +++ b/lib/tremendous/models/generate_reward_link403_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GenerateRewardLink403Response + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'errors' => :'ListRewards401ResponseErrors' + } + 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::GenerateRewardLink403Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GenerateRewardLink403Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + else + self.errors = 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 @errors.nil? + invalid_properties.push('invalid value for "errors", errors 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 @errors.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 && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_token200_response.rb b/lib/tremendous/models/generate_reward_token200_response.rb new file mode 100644 index 0000000..f05e1d4 --- /dev/null +++ b/lib/tremendous/models/generate_reward_token200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GenerateRewardToken200Response + attr_accessor :reward + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reward' => :'GenerateRewardToken200ResponseReward' + } + 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::GenerateRewardToken200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GenerateRewardToken200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + else + self.reward = 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 @reward.nil? + invalid_properties.push('invalid value for "reward", reward 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 @reward.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 && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_token200_response_reward.rb b/lib/tremendous/models/generate_reward_token200_response_reward.rb new file mode 100644 index 0000000..e23e8a5 --- /dev/null +++ b/lib/tremendous/models/generate_reward_token200_response_reward.rb @@ -0,0 +1,257 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # The redemption token for a reward. + class GenerateRewardToken200ResponseReward + # Tremendous ID of the reward + attr_accessor :id + + # The token to redeem the reward. + attr_accessor :token + + # Date the token expires + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'token' => :'token', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'token' => :'String', + :'expires_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::GenerateRewardToken200ResponseReward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GenerateRewardToken200ResponseReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + token == o.token && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, token, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/get_campaign200_response.rb b/lib/tremendous/models/get_campaign200_response.rb new file mode 100644 index 0000000..0c8de51 --- /dev/null +++ b/lib/tremendous/models/get_campaign200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetCampaign200Response + attr_accessor :campaign + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaign' => :'campaign' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'campaign' => :'ListCampaigns200ResponseCampaignsInner' + } + 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::GetCampaign200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetCampaign200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'campaign') + self.campaign = attributes[:'campaign'] + else + self.campaign = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @campaign.nil? + invalid_properties.push('invalid value for "campaign", campaign cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @campaign.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + campaign == o.campaign + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [campaign].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/get_funding_source200_response.rb b/lib/tremendous/models/get_funding_source200_response.rb new file mode 100644 index 0000000..565b7c3 --- /dev/null +++ b/lib/tremendous/models/get_funding_source200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetFundingSource200Response + attr_accessor :funding_source + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'funding_source' => :'funding_source' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'funding_source' => :'ListFundingSources200ResponseFundingSourcesInner' + } + 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::GetFundingSource200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetFundingSource200Response`. Please check the name 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') + self.funding_source = attributes[:'funding_source'] + else + self.funding_source = 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.nil? + invalid_properties.push('invalid value for "funding_source", funding_source 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.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 == o.funding_source + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [funding_source].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/get_member200_response.rb b/lib/tremendous/models/get_member200_response.rb new file mode 100644 index 0000000..ffe1202 --- /dev/null +++ b/lib/tremendous/models/get_member200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetMember200Response + attr_accessor :member + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'member' => :'member' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'member' => :'GetMember200ResponseMember' + } + 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::GetMember200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetMember200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'member') + self.member = attributes[:'member'] + else + self.member = 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 @member.nil? + invalid_properties.push('invalid value for "member", member 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 @member.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 && + member == o.member + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [member].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/get_member200_response_member.rb b/lib/tremendous/models/get_member200_response_member.rb new file mode 100644 index 0000000..b3939cf --- /dev/null +++ b/lib/tremendous/models/get_member200_response_member.rb @@ -0,0 +1,365 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 GetMember200ResponseMember + attr_accessor :id + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + # List of events related to the member. + attr_accessor :events + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status', + :'events' => :'events' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String', + :'events' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::GetMember200ResponseMember` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetMember200ResponseMember`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status && + events == o.events + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status, events].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/get_member200_response_member_events_inner.rb b/lib/tremendous/models/get_member200_response_member_events_inner.rb new file mode 100644 index 0000000..e477785 --- /dev/null +++ b/lib/tremendous/models/get_member200_response_member_events_inner.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetMember200ResponseMemberEventsInner + # 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::GetMember200ResponseMemberEventsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetMember200ResponseMemberEventsInner`. Please check the name 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/get_organization200_response.rb b/lib/tremendous/models/get_organization200_response.rb new file mode 100644 index 0000000..4b0698a --- /dev/null +++ b/lib/tremendous/models/get_organization200_response.rb @@ -0,0 +1,214 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetOrganization200Response + attr_accessor :organization + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organization' => :'organization' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'organization' => :'ListOrganizations200ResponseOrganizationsInner' + } + 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::GetOrganization200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetOrganization200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'organization') + self.organization = attributes[:'organization'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + organization == o.organization + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [organization].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/get_product200_response.rb b/lib/tremendous/models/get_product200_response.rb new file mode 100644 index 0000000..0789b80 --- /dev/null +++ b/lib/tremendous/models/get_product200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetProduct200Response + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product' => :'ListProducts200ResponseProductsInner' + } + 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::GetProduct200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetProduct200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product') + self.product = attributes[:'product'] + else + self.product = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @product.nil? + invalid_properties.push('invalid value for "product", product cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @product.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/get_reward200_response.rb b/lib/tremendous/models/get_reward200_response.rb new file mode 100644 index 0000000..afbdb2f --- /dev/null +++ b/lib/tremendous/models/get_reward200_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class GetReward200Response + attr_accessor :reward + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'reward' => :'ListRewards200ResponseRewardsInner' + } + 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::GetReward200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::GetReward200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + else + self.reward = 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 @reward.nil? + invalid_properties.push('invalid value for "reward", reward 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 @reward.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 && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/invoice.rb b/lib/tremendous/models/invoice.rb new file mode 100644 index 0000000..a8883ea --- /dev/null +++ b/lib/tremendous/models/invoice.rb @@ -0,0 +1,356 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Invoices are instruments to fund your Tremendous account's balance. Invoices can be created by your organization programatically. Once we receive your payment, the invoice is marked as `PAID` and we add the respective funds to your account's balance. + class Invoice + # The invoice number + attr_accessor :id + + # Reference to the purchase order number within your organization + attr_accessor :po_number + + # Amount of the invoice in USD + attr_accessor :amount + + # Status of this invoice
Status Description
DELETED Invoice has been deleted by your organization
PAID Invoice has been paid by your organization
OPEN Invoice has been created by your organization but has not been paid, yet
+ attr_accessor :status + + # List of orders related to the invoice (it doesn't apply to prefunding) + attr_accessor :orders + + # List of rewards related to the invoice (it doesn't apply to prefunding) + attr_accessor :rewards + + # Timestamp of when the invoice has been created. + attr_accessor :created_at + + # Timestamp of when the invoice has been paid. + attr_accessor :paid_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'po_number' => :'po_number', + :'amount' => :'amount', + :'status' => :'status', + :'orders' => :'orders', + :'rewards' => :'rewards', + :'created_at' => :'created_at', + :'paid_at' => :'paid_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'po_number' => :'String', + :'amount' => :'Float', + :'status' => :'String', + :'orders' => :'Array', + :'rewards' => :'Array', + :'created_at' => :'Date', + :'paid_at' => :'Date' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'po_number', + :'paid_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Invoice` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Invoice`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'po_number') + self.po_number = attributes[:'po_number'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + else + self.amount = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'orders') + if (value = attributes[:'orders']).is_a?(Array) + self.orders = value + end + end + + if attributes.key?(:'rewards') + if (value = attributes[:'rewards']).is_a?(Array) + self.rewards = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + else + self.paid_at = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @amount.nil? + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + return false unless status_validator.valid?(@status) + return false if @created_at.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + po_number == o.po_number && + amount == o.amount && + status == o.status && + orders == o.orders && + rewards == o.rewards && + created_at == o.created_at && + paid_at == o.paid_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, po_number, amount, status, orders, rewards, created_at, paid_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_balance_transactions200_response.rb b/lib/tremendous/models/list_balance_transactions200_response.rb new file mode 100644 index 0000000..c27a4f3 --- /dev/null +++ b/lib/tremendous/models/list_balance_transactions200_response.rb @@ -0,0 +1,216 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListBalanceTransactions200Response + attr_accessor :invoices + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'invoices' => :'invoices' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'invoices' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListBalanceTransactions200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListBalanceTransactions200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'invoices') + if (value = attributes[:'invoices']).is_a?(Array) + self.invoices = 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 && + invoices == o.invoices + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [invoices].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_balance_transactions200_response_invoices_inner.rb b/lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb new file mode 100644 index 0000000..560ec2b --- /dev/null +++ b/lib/tremendous/models/list_balance_transactions200_response_invoices_inner.rb @@ -0,0 +1,256 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # A balance transaction represents a specific movement or change in an account's balance. + class ListBalanceTransactions200ResponseInvoicesInner + # Date that the transaction was created + attr_accessor :created_at + + # Amount of the transaction in USD + attr_accessor :amount + + # The updated total after the transaction. Note that this running balance may be delayed and contain `null`. + attr_accessor :balance + + # The action that was performed + attr_accessor :action + + # A brief description of the transaction + attr_accessor :description + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'created_at' => :'created_at', + :'amount' => :'amount', + :'balance' => :'balance', + :'action' => :'action', + :'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 + { + :'created_at' => :'Date', + :'amount' => :'Float', + :'balance' => :'Float', + :'action' => :'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::ListBalanceTransactions200ResponseInvoicesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListBalanceTransactions200ResponseInvoicesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'balance') + self.balance = attributes[:'balance'] + end + + if attributes.key?(:'action') + self.action = attributes[:'action'] + 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 && + created_at == o.created_at && + amount == o.amount && + balance == o.balance && + action == o.action && + 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 + [created_at, amount, balance, action, 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/list_campaigns200_response.rb b/lib/tremendous/models/list_campaigns200_response.rb new file mode 100644 index 0000000..be6b0aa --- /dev/null +++ b/lib/tremendous/models/list_campaigns200_response.rb @@ -0,0 +1,223 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListCampaigns200Response + attr_accessor :campaigns + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'campaigns' => :'campaigns' + } + end + + # 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' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListCampaigns200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListCampaigns200Response`. Please check the name 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') + if (value = attributes[:'campaigns']).is_a?(Array) + self.campaigns = value + end + else + self.campaigns = 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 @campaigns.nil? + invalid_properties.push('invalid value for "campaigns", campaigns 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 @campaigns.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 && + campaigns == o.campaigns + end + + # @see the `==` method + # @param [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].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_campaigns200_response_campaigns_inner.rb b/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb new file mode 100644 index 0000000..455d2dd --- /dev/null +++ b/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb @@ -0,0 +1,292 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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. > Note: Campaigns must be created from the Tremendous dashboard. > > • [Production Dashboard](https://app.tremendous.com) > • [Sandbox Dashboard](https://app.testflight.tremendous.com/) + class ListCampaigns200ResponseCampaignsInner + attr_accessor :id + + # Name of the campaign + attr_accessor :name + + # Description of the campaign + attr_accessor :description + + # List of IDs of products (different gift cards, charity, etc.) that are available in this campaign. + attr_accessor :products + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'products' => :'products' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'products' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'description', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListCampaigns200ResponseCampaignsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListCampaigns200ResponseCampaignsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + 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 + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + 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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @products.nil? + 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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + products == o.products + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, products].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_fields200_response.rb b/lib/tremendous/models/list_fields200_response.rb new file mode 100644 index 0000000..9cede4b --- /dev/null +++ b/lib/tremendous/models/list_fields200_response.rb @@ -0,0 +1,216 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListFields200Response + attr_accessor :fields + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'fields' => :'fields' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'fields' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListFields200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListFields200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'fields') + if (value = attributes[:'fields']).is_a?(Array) + self.fields = 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 && + fields == o.fields + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [fields].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_fields200_response_fields_inner.rb b/lib/tremendous/models/list_fields200_response_fields_inner.rb new file mode 100644 index 0000000..2eb86c0 --- /dev/null +++ b/lib/tremendous/models/list_fields200_response_fields_inner.rb @@ -0,0 +1,286 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListFields200ResponseFieldsInner + attr_accessor :id + + # Label of the field + attr_accessor :label + + # Type of the values of the field + attr_accessor :data_type + + attr_accessor :data + + # Is this field required (true) or optional (false) + attr_accessor :required + + # Type of objects this field gets associated with + attr_accessor :scope + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'label' => :'label', + :'data_type' => :'data_type', + :'data' => :'data', + :'required' => :'required', + :'scope' => :'scope' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'label' => :'String', + :'data_type' => :'String', + :'data' => :'Hash', + :'required' => :'Boolean', + :'scope' => :'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::ListFields200ResponseFieldsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListFields200ResponseFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'label') + self.label = attributes[:'label'] + end + + if attributes.key?(:'data_type') + self.data_type = attributes[:'data_type'] + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Hash) + self.data = value + end + end + + if attributes.key?(:'required') + self.required = attributes[:'required'] + end + + if attributes.key?(:'scope') + self.scope = attributes[:'scope'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + label == o.label && + data_type == o.data_type && + data == o.data && + required == o.required && + scope == o.scope + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, label, data_type, data, required, scope].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_funding_sources200_response.rb b/lib/tremendous/models/list_funding_sources200_response.rb new file mode 100644 index 0000000..101df09 --- /dev/null +++ b/lib/tremendous/models/list_funding_sources200_response.rb @@ -0,0 +1,223 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListFundingSources200Response + attr_accessor :funding_sources + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'funding_sources' => :'funding_sources' + } + end + + # 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_sources' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListFundingSources200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListFundingSources200Response`. Please check the name 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_sources') + if (value = attributes[:'funding_sources']).is_a?(Array) + self.funding_sources = value + end + else + self.funding_sources = 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_sources.nil? + invalid_properties.push('invalid value for "funding_sources", funding_sources 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_sources.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_sources == o.funding_sources + end + + # @see the `==` method + # @param [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_sources].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_funding_sources200_response_funding_sources_inner.rb b/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb new file mode 100644 index 0000000..db544b2 --- /dev/null +++ b/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner.rb @@ -0,0 +1,332 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # + class ListFundingSources200ResponseFundingSourcesInner + attr_accessor :id + + # You can pay for rewards using different payment methods on Tremendous:
Payment Method Description
balance Pre-funded balance in your Tremendous account to draw funds from to send rewards to recipients.
bank_account Bank account to draw funds from to send rewards to recipients.
credit_card Credit card to draw funds from to send rewards to recipients.
invoice Send rewards to recipients and pay by invoice.
+ attr_accessor :method + + # **Only available when `method` is set to `invoice`.** + attr_accessor :type + + attr_accessor :meta + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'method' => :'method', + :'type' => :'type', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'method' => :'String', + :'type' => :'String', + :'meta' => :'ListFundingSources200ResponseFundingSourcesInnerMeta' + } + 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::ListFundingSources200ResponseFundingSourcesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListFundingSources200ResponseFundingSourcesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + else + self.method = nil + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + else + self.meta = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + if @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @meta.nil? + invalid_properties.push('invalid value for "meta", meta cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @method.nil? + method_validator = EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + return false unless method_validator.valid?(@method) + type_validator = EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + return false unless type_validator.valid?(@type) + return false if @meta.nil? + 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 checking allowed values (enum). + # @param [Object] method Object to be assigned + def method=(method) + validator = EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + 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] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + method == o.method && + type == o.type && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, method, type, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_funding_sources200_response_funding_sources_inner_meta.rb b/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb new file mode 100644 index 0000000..b4123c9 --- /dev/null +++ b/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb @@ -0,0 +1,435 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListFundingSources200ResponseFundingSourcesInnerMeta + # **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 `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 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'last_payment_failed_at' => :'last_payment_failed_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'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', + :'last_payment_failed_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'last_payment_failed_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListFundingSources200ResponseFundingSourcesInnerMeta`. Please check the name 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?(:'last_payment_failed_at') + self.last_payment_failed_at = attributes[:'last_payment_failed_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 && + last_payment_failed_at == o.last_payment_failed_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [available_cents, pending_cents, accountholder_name, account_type, bank_name, account_number_mask, account_routing_mask, refundable, network, last4, expired, last_payment_failed_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_invoices200_response.rb b/lib/tremendous/models/list_invoices200_response.rb new file mode 100644 index 0000000..5fd653c --- /dev/null +++ b/lib/tremendous/models/list_invoices200_response.rb @@ -0,0 +1,240 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListInvoices200Response + attr_accessor :invoices + + # The total number of invoices across all pages + attr_accessor :total_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'invoices' => :'invoices', + :'total_count' => :'total_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'invoices' => :'Array', + :'total_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListInvoices200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListInvoices200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'invoices') + if (value = attributes[:'invoices']).is_a?(Array) + self.invoices = value + end + else + self.invoices = nil + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + else + self.total_count = 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 @invoices.nil? + invalid_properties.push('invalid value for "invoices", invoices cannot be nil.') + end + + if @total_count.nil? + invalid_properties.push('invalid value for "total_count", total_count 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 @invoices.nil? + return false if @total_count.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 && + invoices == o.invoices && + total_count == o.total_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [invoices, total_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_invoices200_response_invoices_inner.rb b/lib/tremendous/models/list_invoices200_response_invoices_inner.rb new file mode 100644 index 0000000..cd513e6 --- /dev/null +++ b/lib/tremendous/models/list_invoices200_response_invoices_inner.rb @@ -0,0 +1,356 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Invoices are instruments to fund your Tremendous account's balance. Invoices can be created by your organization programatically. Once we receive your payment, the invoice is marked as `PAID` and we add the respective funds to your account's balance. + class ListInvoices200ResponseInvoicesInner + # The invoice number + attr_accessor :id + + # Reference to the purchase order number within your organization + attr_accessor :po_number + + # Amount of the invoice in USD + attr_accessor :amount + + # Status of this invoice
Status Description
DELETED Invoice has been deleted by your organization
PAID Invoice has been paid by your organization
OPEN Invoice has been created by your organization but has not been paid, yet
+ attr_accessor :status + + # List of orders related to the invoice (it doesn't apply to prefunding) + attr_accessor :orders + + # List of rewards related to the invoice (it doesn't apply to prefunding) + attr_accessor :rewards + + # Timestamp of when the invoice has been created. + attr_accessor :created_at + + # Timestamp of when the invoice has been paid. + attr_accessor :paid_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'po_number' => :'po_number', + :'amount' => :'amount', + :'status' => :'status', + :'orders' => :'orders', + :'rewards' => :'rewards', + :'created_at' => :'created_at', + :'paid_at' => :'paid_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'po_number' => :'String', + :'amount' => :'Float', + :'status' => :'String', + :'orders' => :'Array', + :'rewards' => :'Array', + :'created_at' => :'Date', + :'paid_at' => :'Date' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'po_number', + :'paid_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListInvoices200ResponseInvoicesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListInvoices200ResponseInvoicesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'po_number') + self.po_number = attributes[:'po_number'] + end + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + else + self.amount = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'orders') + if (value = attributes[:'orders']).is_a?(Array) + self.orders = value + end + end + + if attributes.key?(:'rewards') + if (value = attributes[:'rewards']).is_a?(Array) + self.rewards = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + else + self.paid_at = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @amount.nil? + invalid_properties.push('invalid value for "amount", amount cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @amount.nil? + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + return false unless status_validator.valid?(@status) + return false if @created_at.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + po_number == o.po_number && + amount == o.amount && + status == o.status && + orders == o.orders && + rewards == o.rewards && + created_at == o.created_at && + paid_at == o.paid_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, po_number, amount, status, orders, rewards, created_at, paid_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_members200_response.rb b/lib/tremendous/models/list_members200_response.rb new file mode 100644 index 0000000..c24c949 --- /dev/null +++ b/lib/tremendous/models/list_members200_response.rb @@ -0,0 +1,223 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListMembers200Response + attr_accessor :members + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'members' => :'members' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'members' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListMembers200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListMembers200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'members') + if (value = attributes[:'members']).is_a?(Array) + self.members = value + end + else + self.members = 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 @members.nil? + invalid_properties.push('invalid value for "members", members 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 @members.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 && + members == o.members + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [members].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_members200_response_members_inner.rb b/lib/tremendous/models/list_members200_response_members_inner.rb new file mode 100644 index 0000000..b26e054 --- /dev/null +++ b/lib/tremendous/models/list_members200_response_members_inner.rb @@ -0,0 +1,374 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 ListMembers200ResponseMembersInner + attr_accessor :id + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + # Timestamp when this member was created. The `created_at` timestamp is **NOT** returned when retrieving a member (but is part of the response when listing or creating members). + attr_accessor :created_at + + # Timestamp when this member most recently logged into the dashboard of the organization associated with this API key. + attr_accessor :last_login_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status', + :'created_at' => :'created_at', + :'last_login_at' => :'last_login_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String', + :'created_at' => :'Time', + :'last_login_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'last_login_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListMembers200ResponseMembersInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListMembers200ResponseMembersInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'last_login_at') + self.last_login_at = attributes[:'last_login_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status && + created_at == o.created_at && + last_login_at == o.last_login_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status, created_at, last_login_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_orders200_response.rb b/lib/tremendous/models/list_orders200_response.rb new file mode 100644 index 0000000..c450e50 --- /dev/null +++ b/lib/tremendous/models/list_orders200_response.rb @@ -0,0 +1,240 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListOrders200Response + attr_accessor :orders + + # The total number of orders across all pages + attr_accessor :total_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'orders' => :'orders', + :'total_count' => :'total_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'orders' => :'Array', + :'total_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListOrders200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrders200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'orders') + if (value = attributes[:'orders']).is_a?(Array) + self.orders = value + end + else + self.orders = nil + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + else + self.total_count = 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 @orders.nil? + invalid_properties.push('invalid value for "orders", orders cannot be nil.') + end + + if @total_count.nil? + invalid_properties.push('invalid value for "total_count", total_count 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 @orders.nil? + return false if @total_count.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 && + orders == o.orders && + total_count == o.total_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [orders, total_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_orders200_response_orders_inner.rb b/lib/tremendous/models/list_orders200_response_orders_inner.rb new file mode 100644 index 0000000..3278fd1 --- /dev/null +++ b/lib/tremendous/models/list_orders200_response_orders_inner.rb @@ -0,0 +1,379 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # An order wraps around the fulfilment of one or more rewards. + class ListOrders200ResponseOrdersInner + # 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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'ListOrders200ResponseOrdersInnerPayment', + :'invoice_id' => :'String', + :'reward' => :'ListRewards200ResponseRewardsInner' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListOrders200ResponseOrdersInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrders200ResponseOrdersInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @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"]) + return false unless status_validator.valid?(@status) + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_id, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_orders200_response_orders_inner_payment.rb b/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb new file mode 100644 index 0000000..ea3a74e --- /dev/null +++ b/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb @@ -0,0 +1,346 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 ListOrders200ResponseOrdersInnerPayment + # Total price of the order before fees (in USD) + attr_accessor :subtotal + + # Total price of the order including fees (in USD) + attr_accessor :total + + # Fees for the order (in USD) + attr_accessor :fees + + attr_accessor :refund + + # Name of the channel in which the order was created + attr_accessor :channel + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'subtotal' => :'subtotal', + :'total' => :'total', + :'fees' => :'fees', + :'refund' => :'refund', + :'channel' => :'channel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'subtotal' => :'Float', + :'total' => :'Float', + :'fees' => :'Float', + :'refund' => :'ListOrders200ResponseOrdersInnerPaymentRefund', + :'channel' => :'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::ListOrders200ResponseOrdersInnerPayment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrders200ResponseOrdersInnerPayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'subtotal') + self.subtotal = attributes[:'subtotal'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'fees') + self.fees = attributes[:'fees'] + end + + if attributes.key?(:'refund') + self.refund = attributes[:'refund'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@subtotal.nil? && @subtotal < 0 + invalid_properties.push('invalid value for "subtotal", must be greater than or equal to 0.') + end + + if !@total.nil? && @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + if !@fees.nil? && @fees < 0 + invalid_properties.push('invalid value for "fees", 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 !@subtotal.nil? && @subtotal < 0 + return false if !@total.nil? && @total < 0 + return false if !@fees.nil? && @fees < 0 + 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] subtotal Value to be assigned + def subtotal=(subtotal) + if subtotal.nil? + fail ArgumentError, 'subtotal cannot be nil' + end + + if subtotal < 0 + fail ArgumentError, 'invalid value for "subtotal", must be greater than or equal to 0.' + end + + @subtotal = subtotal + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Custom attribute writer method with validation + # @param [Object] fees Value to be assigned + def fees=(fees) + if fees.nil? + fail ArgumentError, 'fees cannot be nil' + end + + if fees < 0 + fail ArgumentError, 'invalid value for "fees", must be greater than or equal to 0.' + end + + @fees = fees + 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) + return true if self.equal?(o) + self.class == o.class && + subtotal == o.subtotal && + total == o.total && + fees == o.fees && + refund == o.refund && + channel == o.channel + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [subtotal, total, fees, refund, channel].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_orders200_response_orders_inner_payment_refund.rb b/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb new file mode 100644 index 0000000..94bd95b --- /dev/null +++ b/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb @@ -0,0 +1,242 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 ListOrders200ResponseOrdersInnerPaymentRefund + # Total amount of the order refunds (in USD) + attr_accessor :total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'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::ListOrders200ResponseOrdersInnerPaymentRefund` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrders200ResponseOrdersInnerPaymentRefund`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + else + self.total = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total.nil? + invalid_properties.push('invalid value for "total", total cannot be nil.') + end + + if @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total.nil? + return false if @total < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_organizations200_response.rb b/lib/tremendous/models/list_organizations200_response.rb new file mode 100644 index 0000000..ee8fbe0 --- /dev/null +++ b/lib/tremendous/models/list_organizations200_response.rb @@ -0,0 +1,216 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListOrganizations200Response + attr_accessor :organizations + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'organizations' => :'organizations' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'organizations' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListOrganizations200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrganizations200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'organizations') + if (value = attributes[:'organizations']).is_a?(Array) + self.organizations = 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 && + organizations == o.organizations + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [organizations].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_organizations200_response_organizations_inner.rb b/lib/tremendous/models/list_organizations200_response_organizations_inner.rb new file mode 100644 index 0000000..1967478 --- /dev/null +++ b/lib/tremendous/models/list_organizations200_response_organizations_inner.rb @@ -0,0 +1,324 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Organizations are a way to separate different parts of your business within the same Tremendous account. Your root Tremendous account is an organization itself and can have multiple sub-organizations. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. Each organizations can have it's own API key. + class ListOrganizations200ResponseOrganizationsInner + attr_accessor :id + + # Name of the organization + attr_accessor :name + + # URL of the website of that organization + attr_accessor :website + + # Status of the organization. Organizations need to be approved to be able to use them to send out rewards. + attr_accessor :status + + # Timestamp of when the organization has been created. *This field is only returned when creating an organization.* It is not returned anymore when retrieving or listing organizations. + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'website' => :'website', + :'status' => :'status', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'website' => :'String', + :'status' => :'String', + :'created_at' => :'Date' + } + 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::ListOrganizations200ResponseOrganizationsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListOrganizations200ResponseOrganizationsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'website') + self.website = attributes[:'website'] + else + self.website = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @website.nil? + invalid_properties.push('invalid value for "website", website cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @website.nil? + status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + website == o.website && + status == o.status && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, website, status, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_products200_response.rb b/lib/tremendous/models/list_products200_response.rb new file mode 100644 index 0000000..9e80a1f --- /dev/null +++ b/lib/tremendous/models/list_products200_response.rb @@ -0,0 +1,223 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListProducts200Response + attr_accessor :products + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'products' => :'products' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'products' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListProducts200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListProducts200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + else + self.products = 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 @products.nil? + invalid_properties.push('invalid value for "products", products 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 @products.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 && + products == o.products + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [products].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_products200_response_products_inner.rb b/lib/tremendous/models/list_products200_response_products_inner.rb new file mode 100644 index 0000000..ae85a2c --- /dev/null +++ b/lib/tremendous/models/list_products200_response_products_inner.rb @@ -0,0 +1,457 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # A product represents one way to payout a reward to it's recipient. Think: * Amazon.com gift card (ID: `OKMHM2X2OHYV`) * Donations to Save the Children (ID: `ESRNAD533W5A`) * Virtual Visa debit card (ID: `Q24BD9EZ332JT`) each of which is one specific product on Tremendous. > 📘 All available products > > See this [list](https://www.tremendous.com/catalog) Products can be limited in their availability to recipients by * geography (field `countries`) * currency (field `currencies`) * amount of the reward (field `skus`) * e.g. adidas gift cards accept any amount between 5 and 200 USD. See the description of each respective parameter for further details. + class ListProducts200ResponseProductsInner + attr_accessor :id + + # Name of the product + attr_accessor :name + + # Detailed description of the product. Mostly used for products with a `category` of `charities`. + attr_accessor :description + + # The category of this product
Category Description
ach Bank transfer to the recipient
charity Donations to a charity
merchant_card A gift card for a certain merchant (e.g. Amazon)
paypal Payout via PayPal
venmo Payout via Venmo
visa_card Payout in form of a Visa debit card
+ attr_accessor :category + + # Legal disclosures for this product. Can be in HTML format. + attr_accessor :disclosure + + # Products may are restricted in their usage based on the amount of the reward. The `skus` array defines bands of denominations in which this product may be used for payouts. + attr_accessor :skus + + # Available currencies for this product + attr_accessor :currency_codes + + # List of countries in which this product is available to recipients. + attr_accessor :countries + + # List of product images associated with this product (e.g. logos or images of the gift cards) + attr_accessor :images + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'category' => :'category', + :'disclosure' => :'disclosure', + :'skus' => :'skus', + :'currency_codes' => :'currency_codes', + :'countries' => :'countries', + :'images' => :'images' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'category' => :'String', + :'disclosure' => :'String', + :'skus' => :'Array', + :'currency_codes' => :'Array', + :'countries' => :'Array', + :'images' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListProducts200ResponseProductsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListProducts200ResponseProductsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + else + self.description = nil + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + else + self.category = nil + end + + if attributes.key?(:'disclosure') + self.disclosure = attributes[:'disclosure'] + else + self.disclosure = nil + end + + if attributes.key?(:'skus') + if (value = attributes[:'skus']).is_a?(Array) + self.skus = value + end + end + + if attributes.key?(:'currency_codes') + if (value = attributes[:'currency_codes']).is_a?(Array) + self.currency_codes = value + end + else + self.currency_codes = nil + end + + if attributes.key?(:'countries') + if (value = attributes[:'countries']).is_a?(Array) + self.countries = value + end + else + self.countries = nil + end + + if attributes.key?(:'images') + if (value = attributes[:'images']).is_a?(Array) + self.images = value + end + else + self.images = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @category.nil? + invalid_properties.push('invalid value for "category", category cannot be nil.') + end + + if @disclosure.nil? + invalid_properties.push('invalid value for "disclosure", disclosure cannot be nil.') + end + + if @currency_codes.nil? + invalid_properties.push('invalid value for "currency_codes", currency_codes cannot be nil.') + end + + if @currency_codes.length < 1 + invalid_properties.push('invalid value for "currency_codes", number of items must be greater than or equal to 1.') + end + + if @countries.nil? + invalid_properties.push('invalid value for "countries", countries cannot be nil.') + end + + if @countries.length < 1 + invalid_properties.push('invalid value for "countries", number of items must be greater than or equal to 1.') + end + + if @images.nil? + invalid_properties.push('invalid value for "images", images cannot be nil.') + end + + if @images.length < 0 + invalid_properties.push('invalid value for "images", number of items 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 @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @description.nil? + return false if @category.nil? + category_validator = EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + return false unless category_validator.valid?(@category) + return false if @disclosure.nil? + return false if @currency_codes.nil? + return false if @currency_codes.length < 1 + return false if @countries.nil? + return false if @countries.length < 1 + return false if @images.nil? + return false if @images.length < 0 + 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 checking allowed values (enum). + # @param [Object] category Object to be assigned + def category=(category) + validator = EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + unless validator.valid?(category) + fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}." + end + @category = category + end + + # Custom attribute writer method with validation + # @param [Object] countries Value to be assigned + def countries=(countries) + if countries.nil? + fail ArgumentError, 'countries cannot be nil' + end + + if countries.length < 1 + fail ArgumentError, 'invalid value for "countries", number of items must be greater than or equal to 1.' + end + + @countries = countries + end + + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length < 0 + fail ArgumentError, 'invalid value for "images", number of items must be greater than or equal to 0.' + end + + @images = images + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + category == o.category && + disclosure == o.disclosure && + skus == o.skus && + currency_codes == o.currency_codes && + countries == o.countries && + images == o.images + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, category, disclosure, skus, currency_codes, countries, images].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_products200_response_products_inner_countries_inner.rb b/lib/tremendous/models/list_products200_response_products_inner_countries_inner.rb new file mode 100644 index 0000000..63a9aa2 --- /dev/null +++ b/lib/tremendous/models/list_products200_response_products_inner_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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListProducts200ResponseProductsInnerCountriesInner + # 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::ListProducts200ResponseProductsInnerCountriesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListProducts200ResponseProductsInnerCountriesInner`. Please check the name 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/list_products200_response_products_inner_images_inner.rb b/lib/tremendous/models/list_products200_response_products_inner_images_inner.rb new file mode 100644 index 0000000..972ad34 --- /dev/null +++ b/lib/tremendous/models/list_products200_response_products_inner_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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListProducts200ResponseProductsInnerImagesInner + # 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::ListProducts200ResponseProductsInnerImagesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListProducts200ResponseProductsInnerImagesInner`. Please check the name 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/list_products200_response_products_inner_skus_inner.rb b/lib/tremendous/models/list_products200_response_products_inner_skus_inner.rb new file mode 100644 index 0000000..68e11dc --- /dev/null +++ b/lib/tremendous/models/list_products200_response_products_inner_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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListProducts200ResponseProductsInnerSkusInner + # 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::ListProducts200ResponseProductsInnerSkusInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListProducts200ResponseProductsInnerSkusInner`. Please check the name 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/list_rewards200_response.rb b/lib/tremendous/models/list_rewards200_response.rb new file mode 100644 index 0000000..07aed21 --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response.rb @@ -0,0 +1,226 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListRewards200Response + attr_accessor :rewards + + # The total number of rewards across all pages + attr_accessor :total_count + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'rewards' => :'rewards', + :'total_count' => :'total_count' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'rewards' => :'Array', + :'total_count' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListRewards200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'rewards') + if (value = attributes[:'rewards']).is_a?(Array) + self.rewards = value + end + end + + if attributes.key?(:'total_count') + self.total_count = attributes[:'total_count'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + rewards == o.rewards && + total_count == o.total_count + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [rewards, total_count].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_rewards200_response_rewards_inner.rb b/lib/tremendous/models/list_rewards200_response_rewards_inner.rb new file mode 100644 index 0000000..3bbbcb8 --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response_rewards_inner.rb @@ -0,0 +1,347 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 ListRewards200ResponseRewardsInner + # 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 + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'ListRewards200ResponseRewardsInnerDelivery' + } + 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::ListRewards200ResponseRewardsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200ResponseRewardsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_id\", must conform to the pattern #{pattern}.") + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_rewards200_response_rewards_inner_custom_fields_inner.rb b/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb new file mode 100644 index 0000000..1a198ff --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response_rewards_inner_custom_fields_inner.rb @@ -0,0 +1,248 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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 ListRewards200ResponseRewardsInnerCustomFieldsInner + # Tremendous ID of the custom field + attr_accessor :id + + # Value of the custom field + attr_accessor :value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'value' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200ResponseRewardsInnerCustomFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_rewards200_response_rewards_inner_delivery.rb b/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb new file mode 100644 index 0000000..f36a422 --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response_rewards_inner_delivery.rb @@ -0,0 +1,286 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class ListRewards200ResponseRewardsInnerDelivery + # 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 + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'method' => :'String', + :'status' => :'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::ListRewards200ResponseRewardsInnerDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200ResponseRewardsInnerDelivery`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [method, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_rewards200_response_rewards_inner_recipient.rb b/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb new file mode 100644 index 0000000..a90d184 --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb @@ -0,0 +1,236 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details of the recipient of the reward + class ListRewards200ResponseRewardsInnerRecipient + # Name of the recipient + attr_accessor :name + + # Email address of the recipient + attr_accessor :email + + # Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +). + attr_accessor :phone + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'email' => :'email', + :'phone' => :'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 + { + :'name' => :'String', + :'email' => :'String', + :'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::ListRewards200ResponseRewardsInnerRecipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200ResponseRewardsInnerRecipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'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 && + name == o.name && + email == o.email && + phone == o.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 + [name, email, 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/list_rewards200_response_rewards_inner_value.rb b/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb new file mode 100644 index 0000000..1939f7b --- /dev/null +++ b/lib/tremendous/models/list_rewards200_response_rewards_inner_value.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListRewards200ResponseRewardsInnerValue + # 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 + { + :'denomination' => :'denomination', + :'currency_code' => :'currency_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'denomination' => :'Float', + :'currency_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListRewards200ResponseRewardsInnerValue` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards200ResponseRewardsInnerValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'denomination') + self.denomination = attributes[:'denomination'] + else + self.denomination = nil + end + + if attributes.key?(:'currency_code') + self.currency_code = attributes[:'currency_code'] + else + self.currency_code = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @denomination.nil? + invalid_properties.push('invalid value for "denomination", denomination cannot be nil.') + end + + if @currency_code.nil? + invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @denomination.nil? + return false if @currency_code.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) + return true if self.equal?(o) + self.class == o.class && + denomination == o.denomination && + currency_code == o.currency_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [denomination, currency_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/list_rewards401_response.rb b/lib/tremendous/models/list_rewards401_response.rb new file mode 100644 index 0000000..56e4393 --- /dev/null +++ b/lib/tremendous/models/list_rewards401_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListRewards401Response + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'errors' => :'ListRewards401ResponseErrors' + } + 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::ListRewards401Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards401Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + else + self.errors = 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 @errors.nil? + invalid_properties.push('invalid value for "errors", errors 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 @errors.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 && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_rewards401_response_errors.rb b/lib/tremendous/models/list_rewards401_response_errors.rb new file mode 100644 index 0000000..36f51c5 --- /dev/null +++ b/lib/tremendous/models/list_rewards401_response_errors.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListRewards401ResponseErrors + # 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' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListRewards401ResponseErrors` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards401ResponseErrors`. Please check the name 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') + self.payload = attributes[:'payload'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # 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/list_rewards429_response.rb b/lib/tremendous/models/list_rewards429_response.rb new file mode 100644 index 0000000..bc48bcb --- /dev/null +++ b/lib/tremendous/models/list_rewards429_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListRewards429Response + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'errors' => :'ListRewards401ResponseErrors' + } + 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::ListRewards429Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListRewards429Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + else + self.errors = 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 @errors.nil? + invalid_properties.push('invalid value for "errors", errors 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 @errors.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 && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_webhook_events200_response.rb b/lib/tremendous/models/list_webhook_events200_response.rb new file mode 100644 index 0000000..5f27a6b --- /dev/null +++ b/lib/tremendous/models/list_webhook_events200_response.rb @@ -0,0 +1,216 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListWebhookEvents200Response + attr_accessor :events + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'events' => :'events' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'events' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListWebhookEvents200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListWebhookEvents200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = 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 && + events == o.events + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [events].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_webhooks200_response.rb b/lib/tremendous/models/list_webhooks200_response.rb new file mode 100644 index 0000000..f2baade --- /dev/null +++ b/lib/tremendous/models/list_webhooks200_response.rb @@ -0,0 +1,216 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListWebhooks200Response + attr_accessor :webhooks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'webhooks' => :'webhooks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'webhooks' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::ListWebhooks200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListWebhooks200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'webhooks') + if (value = attributes[:'webhooks']).is_a?(Array) + self.webhooks = 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 && + webhooks == o.webhooks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [webhooks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/list_webhooks200_response_webhooks_inner.rb b/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb new file mode 100644 index 0000000..a8fca52 --- /dev/null +++ b/lib/tremendous/models/list_webhooks200_response_webhooks_inner.rb @@ -0,0 +1,262 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ListWebhooks200ResponseWebhooksInner + attr_accessor :id + + # URL the webhook will make requests to + attr_accessor :url + + # Private key for the webhook + attr_accessor :private_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'url' => :'url', + :'private_key' => :'private_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'url' => :'String', + :'private_key' => :'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::ListWebhooks200ResponseWebhooksInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ListWebhooks200ResponseWebhooksInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + + if attributes.key?(:'private_key') + self.private_key = attributes[:'private_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @url.nil? + 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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + url == o.url && + private_key == o.private_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, url, private_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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.rb b/lib/tremendous/models/member.rb new file mode 100644 index 0000000..8ea4da4 --- /dev/null +++ b/lib/tremendous/models/member.rb @@ -0,0 +1,374 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 Member + attr_accessor :id + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + # Timestamp when this member was created. The `created_at` timestamp is **NOT** returned when retrieving a member (but is part of the response when listing or creating members). + attr_accessor :created_at + + # Timestamp when this member most recently logged into the dashboard of the organization associated with this API key. + attr_accessor :last_login_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status', + :'created_at' => :'created_at', + :'last_login_at' => :'last_login_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String', + :'created_at' => :'Time', + :'last_login_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'last_login_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Member` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Member`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'last_login_at') + self.last_login_at = attributes[:'last_login_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status && + created_at == o.created_at && + last_login_at == o.last_login_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status, created_at, last_login_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_base.rb b/lib/tremendous/models/member_base.rb new file mode 100644 index 0000000..937646b --- /dev/null +++ b/lib/tremendous/models/member_base.rb @@ -0,0 +1,353 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 MemberBase + attr_accessor :id + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::MemberBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::MemberBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_with_events.rb b/lib/tremendous/models/member_with_events.rb new file mode 100644 index 0000000..4d53c00 --- /dev/null +++ b/lib/tremendous/models/member_with_events.rb @@ -0,0 +1,365 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + # List of events related to the member. + attr_accessor :events + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status', + :'events' => :'events' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String', + :'events' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::MemberWithEvents` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::MemberWithEvents`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'events') + if (value = attributes[:'events']).is_a?(Array) + self.events = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status && + events == o.events + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status, events].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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 new file mode 100644 index 0000000..ceb029a --- /dev/null +++ b/lib/tremendous/models/member_without_events.rb @@ -0,0 +1,374 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 + + # Email address of the member + attr_accessor :email + + # Full name of the member + attr_accessor :name + + # Role of the member within the organization.
Role Description
MEMBER Limited permissions. Can view their own reward and order histories only.
ADMIN Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization.
DELETED No longer a member of this organization.
+ attr_accessor :role + + # Current status of the member's account. When creating a member it starts out in the status `INVITED`. As soon as that member open the invitation link and registers an account, the status switches to `REGISTERED`. + attr_accessor :status + + # Timestamp when this member was created. The `created_at` timestamp is **NOT** returned when retrieving a member (but is part of the response when listing or creating members). + attr_accessor :created_at + + # Timestamp when this member most recently logged into the dashboard of the organization associated with this API key. + attr_accessor :last_login_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'email' => :'email', + :'name' => :'name', + :'role' => :'role', + :'status' => :'status', + :'created_at' => :'created_at', + :'last_login_at' => :'last_login_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'email' => :'String', + :'name' => :'String', + :'role' => :'String', + :'status' => :'String', + :'created_at' => :'Time', + :'last_login_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'last_login_at' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::MemberWithoutEvents` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::MemberWithoutEvents`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + else + self.email = nil + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'role') + self.role = attributes[:'role'] + else + self.role = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'last_login_at') + self.last_login_at = attributes[:'last_login_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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 + + if @email.nil? + invalid_properties.push('invalid value for "email", email cannot be nil.') + end + + if @role.nil? + invalid_properties.push('invalid value for "role", role cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @email.nil? + return false if @role.nil? + role_validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + return false unless role_validator.valid?(@role) + return false if @status.nil? + status_validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] role Object to be assigned + def role=(role) + validator = EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + unless validator.valid?(role) + fail ArgumentError, "invalid value for \"role\", must be one of #{validator.allowable_values}." + end + @role = role + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + email == o.email && + name == o.name && + role == o.role && + status == o.status && + created_at == o.created_at && + last_login_at == o.last_login_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, email, name, role, status, created_at, last_login_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/order.rb b/lib/tremendous/models/order.rb new file mode 100644 index 0000000..ff6d746 --- /dev/null +++ b/lib/tremendous/models/order.rb @@ -0,0 +1,379 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # An order wraps around the fulfilment of one or more rewards. + class Order + # 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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'OrderBasePayment', + :'invoice_id' => :'String', + :'reward' => :'OrderWithoutLinkReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Order` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Order`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @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"]) + return false unless status_validator.valid?(@status) + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_id, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/order_base.rb b/lib/tremendous/models/order_base.rb new file mode 100644 index 0000000..a5833e3 --- /dev/null +++ b/lib/tremendous/models/order_base.rb @@ -0,0 +1,370 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'OrderBasePayment', + :'invoice_id' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::OrderBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @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"]) + return false unless status_validator.valid?(@status) + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_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/order_base_payment.rb b/lib/tremendous/models/order_base_payment.rb new file mode 100644 index 0000000..0461d45 --- /dev/null +++ b/lib/tremendous/models/order_base_payment.rb @@ -0,0 +1,346 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 + + # Total price of the order including fees (in USD) + attr_accessor :total + + # Fees for the order (in USD) + attr_accessor :fees + + attr_accessor :refund + + # Name of the channel in which the order was created + attr_accessor :channel + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'subtotal' => :'subtotal', + :'total' => :'total', + :'fees' => :'fees', + :'refund' => :'refund', + :'channel' => :'channel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'subtotal' => :'Float', + :'total' => :'Float', + :'fees' => :'Float', + :'refund' => :'PaymentDetailsRefund', + :'channel' => :'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::OrderBasePayment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderBasePayment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'subtotal') + self.subtotal = attributes[:'subtotal'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'fees') + self.fees = attributes[:'fees'] + end + + if attributes.key?(:'refund') + self.refund = attributes[:'refund'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@subtotal.nil? && @subtotal < 0 + invalid_properties.push('invalid value for "subtotal", must be greater than or equal to 0.') + end + + if !@total.nil? && @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + if !@fees.nil? && @fees < 0 + invalid_properties.push('invalid value for "fees", 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 !@subtotal.nil? && @subtotal < 0 + return false if !@total.nil? && @total < 0 + return false if !@fees.nil? && @fees < 0 + 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] subtotal Value to be assigned + def subtotal=(subtotal) + if subtotal.nil? + fail ArgumentError, 'subtotal cannot be nil' + end + + if subtotal < 0 + fail ArgumentError, 'invalid value for "subtotal", must be greater than or equal to 0.' + end + + @subtotal = subtotal + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Custom attribute writer method with validation + # @param [Object] fees Value to be assigned + def fees=(fees) + if fees.nil? + fail ArgumentError, 'fees cannot be nil' + end + + if fees < 0 + fail ArgumentError, 'invalid value for "fees", must be greater than or equal to 0.' + end + + @fees = fees + 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) + return true if self.equal?(o) + self.class == o.class && + subtotal == o.subtotal && + total == o.total && + fees == o.fees && + refund == o.refund && + channel == o.channel + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [subtotal, total, fees, refund, channel].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/order_for_create.rb b/lib/tremendous/models/order_for_create.rb new file mode 100644 index 0000000..637fcfd --- /dev/null +++ b/lib/tremendous/models/order_for_create.rb @@ -0,0 +1,248 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class OrderForCreate + # 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 + + attr_accessor :payment + + attr_accessor :reward + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'external_id' => :'external_id', + :'payment' => :'payment', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'external_id' => :'String', + :'payment' => :'CreateOrderRequestPayment', + :'reward' => :'OrderForCreateReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderForCreate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderForCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + else + self.payment = nil + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + else + self.reward = 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 @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 + + invalid_properties + end + + # Check to see if the 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 @payment.nil? + return false if @reward.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 && + external_id == o.external_id && + payment == o.payment && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [external_id, payment, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/order_for_create_reward.rb b/lib/tremendous/models/order_for_create_reward.rb new file mode 100644 index 0000000..572805a --- /dev/null +++ b/lib/tremendous/models/order_for_create_reward.rb @@ -0,0 +1,416 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 OrderForCreateReward + # 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + # Set this to translate the redemption experience for this reward. Pass a 2-letter [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the desired language. Defaults to `en`. + attr_accessor :language + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'language' => :'language', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'language' => :'String', + :'delivery' => :'CreateOrderRequestRewardDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderForCreateReward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderForCreateReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + language == o.language && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/order_status.rb b/lib/tremendous/models/order_status.rb new file mode 100644 index 0000000..c090006 --- /dev/null +++ b/lib/tremendous/models/order_status.rb @@ -0,0 +1,43 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class OrderStatus + CANCELED = "CANCELED".freeze + CART = "CART".freeze + EXECUTED = "EXECUTED".freeze + FAILED = "FAILED".freeze + PENDING_APPROVAL = "PENDING APPROVAL".freeze + + def self.all_vars + @all_vars ||= [CANCELED, CART, EXECUTED, FAILED, PENDING_APPROVAL].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if OrderStatus.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #OrderStatus" + end + end +end diff --git a/lib/tremendous/models/order_with_link.rb b/lib/tremendous/models/order_with_link.rb new file mode 100644 index 0000000..7a0c73f --- /dev/null +++ b/lib/tremendous/models/order_with_link.rb @@ -0,0 +1,400 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + attr_accessor :rewards + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id', + :'rewards' => :'rewards' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'OrderBasePayment', + :'invoice_id' => :'String', + :'rewards' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderWithLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderWithLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'rewards') + if (value = attributes[:'rewards']).is_a?(Array) + self.rewards = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + if !@rewards.nil? && @rewards.length < 1 + invalid_properties.push('invalid value for "rewards", number of items must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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"]) + return false unless status_validator.valid?(@status) + return false if !@rewards.nil? && @rewards.length < 1 + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + 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 with validation + # @param [Object] rewards Value to be assigned + def rewards=(rewards) + if rewards.nil? + fail ArgumentError, 'rewards cannot be nil' + end + + if rewards.length < 1 + fail ArgumentError, 'invalid value for "rewards", number of items must be greater than or equal to 1.' + end + + @rewards = rewards + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id && + rewards == o.rewards + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_id, rewards].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/order_with_link_rewards_inner.rb b/lib/tremendous/models/order_with_link_rewards_inner.rb new file mode 100644 index 0000000..b123081 --- /dev/null +++ b/lib/tremendous/models/order_with_link_rewards_inner.rb @@ -0,0 +1,406 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 OrderWithLinkRewardsInner + # 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'RewardWithLinkDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderWithLinkRewardsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderWithLinkRewardsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/order_without_link.rb b/lib/tremendous/models/order_without_link.rb new file mode 100644 index 0000000..7a2ed0e --- /dev/null +++ b/lib/tremendous/models/order_without_link.rb @@ -0,0 +1,379 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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.
+ attr_accessor :status + + attr_accessor :payment + + # The ID for the invoice associated with this order + attr_accessor :invoice_id + + attr_accessor :reward + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'external_id' => :'external_id', + :'campaign_id' => :'campaign_id', + :'created_at' => :'created_at', + :'status' => :'status', + :'payment' => :'payment', + :'invoice_id' => :'invoice_id', + :'reward' => :'reward' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'external_id' => :'String', + :'campaign_id' => :'String', + :'created_at' => :'Time', + :'status' => :'String', + :'payment' => :'OrderBasePayment', + :'invoice_id' => :'String', + :'reward' => :'OrderWithoutLinkReward' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'external_id', + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderWithoutLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderWithoutLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + else + self.created_at = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'payment') + self.payment = attributes[:'payment'] + end + + if attributes.key?(:'invoice_id') + self.invoice_id = attributes[:'invoice_id'] + end + + if attributes.key?(:'reward') + self.reward = attributes[:'reward'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + 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}.") + end + + if @created_at.nil? + invalid_properties.push('invalid value for "created_at", created_at cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @id.nil? + return false if @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"]) + return false unless status_validator.valid?(@status) + 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) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @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"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + external_id == o.external_id && + campaign_id == o.campaign_id && + created_at == o.created_at && + status == o.status && + payment == o.payment && + invoice_id == o.invoice_id && + reward == o.reward + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, external_id, campaign_id, created_at, status, payment, invoice_id, reward].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/order_without_link_reward.rb b/lib/tremendous/models/order_without_link_reward.rb new file mode 100644 index 0000000..6a9b752 --- /dev/null +++ b/lib/tremendous/models/order_without_link_reward.rb @@ -0,0 +1,406 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 OrderWithoutLinkReward + # 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'RewardWithoutLinkDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::OrderWithoutLinkReward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::OrderWithoutLinkReward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/organization.rb b/lib/tremendous/models/organization.rb new file mode 100644 index 0000000..9356bc9 --- /dev/null +++ b/lib/tremendous/models/organization.rb @@ -0,0 +1,324 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Organizations are a way to separate different parts of your business within the same Tremendous account. Your root Tremendous account is an organization itself and can have multiple sub-organizations. You can assign users in your Tremendous team as members to any organization. Users can be members of multiple organizations at once. Each organizations can have it's own API key. + class Organization + attr_accessor :id + + # Name of the organization + attr_accessor :name + + # URL of the website of that organization + attr_accessor :website + + # Status of the organization. Organizations need to be approved to be able to use them to send out rewards. + attr_accessor :status + + # Timestamp of when the organization has been created. *This field is only returned when creating an organization.* It is not returned anymore when retrieving or listing organizations. + attr_accessor :created_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'website' => :'website', + :'status' => :'status', + :'created_at' => :'created_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'website' => :'String', + :'status' => :'String', + :'created_at' => :'Date' + } + 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::Organization` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Organization`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + else + self.name = nil + end + + if attributes.key?(:'website') + self.website = attributes[:'website'] + else + self.website = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @website.nil? + invalid_properties.push('invalid value for "website", website cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @website.nil? + status_validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + return false unless status_validator.valid?(@status) + 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 checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + website == o.website && + status == o.status && + created_at == o.created_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, website, status, created_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/payment_details.rb b/lib/tremendous/models/payment_details.rb new file mode 100644 index 0000000..822b937 --- /dev/null +++ b/lib/tremendous/models/payment_details.rb @@ -0,0 +1,345 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class PaymentDetails + # Total price of the order before fees (in USD) + attr_accessor :subtotal + + # Total price of the order including fees (in USD) + attr_accessor :total + + # Fees for the order (in USD) + attr_accessor :fees + + attr_accessor :refund + + # Name of the channel in which the order was created + attr_accessor :channel + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'subtotal' => :'subtotal', + :'total' => :'total', + :'fees' => :'fees', + :'refund' => :'refund', + :'channel' => :'channel' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'subtotal' => :'Float', + :'total' => :'Float', + :'fees' => :'Float', + :'refund' => :'PaymentDetailsRefund', + :'channel' => :'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::PaymentDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::PaymentDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'subtotal') + self.subtotal = attributes[:'subtotal'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'fees') + self.fees = attributes[:'fees'] + end + + if attributes.key?(:'refund') + self.refund = attributes[:'refund'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@subtotal.nil? && @subtotal < 0 + invalid_properties.push('invalid value for "subtotal", must be greater than or equal to 0.') + end + + if !@total.nil? && @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + if !@fees.nil? && @fees < 0 + invalid_properties.push('invalid value for "fees", 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 !@subtotal.nil? && @subtotal < 0 + return false if !@total.nil? && @total < 0 + return false if !@fees.nil? && @fees < 0 + 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] subtotal Value to be assigned + def subtotal=(subtotal) + if subtotal.nil? + fail ArgumentError, 'subtotal cannot be nil' + end + + if subtotal < 0 + fail ArgumentError, 'invalid value for "subtotal", must be greater than or equal to 0.' + end + + @subtotal = subtotal + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Custom attribute writer method with validation + # @param [Object] fees Value to be assigned + def fees=(fees) + if fees.nil? + fail ArgumentError, 'fees cannot be nil' + end + + if fees < 0 + fail ArgumentError, 'invalid value for "fees", must be greater than or equal to 0.' + end + + @fees = fees + 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) + return true if self.equal?(o) + self.class == o.class && + subtotal == o.subtotal && + total == o.total && + fees == o.fees && + refund == o.refund && + channel == o.channel + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [subtotal, total, fees, refund, channel].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/payment_details_refund.rb b/lib/tremendous/models/payment_details_refund.rb new file mode 100644 index 0000000..95bbc1e --- /dev/null +++ b/lib/tremendous/models/payment_details_refund.rb @@ -0,0 +1,242 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'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::PaymentDetailsRefund` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::PaymentDetailsRefund`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + else + self.total = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total.nil? + invalid_properties.push('invalid value for "total", total cannot be nil.') + end + + if @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total.nil? + return false if @total < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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.rb b/lib/tremendous/models/product.rb new file mode 100644 index 0000000..278a245 --- /dev/null +++ b/lib/tremendous/models/product.rb @@ -0,0 +1,457 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # A product represents one way to payout a reward to it's recipient. Think: * Amazon.com gift card (ID: `OKMHM2X2OHYV`) * Donations to Save the Children (ID: `ESRNAD533W5A`) * Virtual Visa debit card (ID: `Q24BD9EZ332JT`) each of which is one specific product on Tremendous. > 📘 All available products > > See this [list](https://www.tremendous.com/catalog) Products can be limited in their availability to recipients by * geography (field `countries`) * currency (field `currencies`) * amount of the reward (field `skus`) * e.g. adidas gift cards accept any amount between 5 and 200 USD. See the description of each respective parameter for further details. + class Product + attr_accessor :id + + # Name of the product + attr_accessor :name + + # Detailed description of the product. Mostly used for products with a `category` of `charities`. + attr_accessor :description + + # The category of this product
Category Description
ach Bank transfer to the recipient
charity Donations to a charity
merchant_card A gift card for a certain merchant (e.g. Amazon)
paypal Payout via PayPal
venmo Payout via Venmo
visa_card Payout in form of a Visa debit card
+ attr_accessor :category + + # Legal disclosures for this product. Can be in HTML format. + attr_accessor :disclosure + + # Products may are restricted in their usage based on the amount of the reward. The `skus` array defines bands of denominations in which this product may be used for payouts. + attr_accessor :skus + + # Available currencies for this product + attr_accessor :currency_codes + + # List of countries in which this product is available to recipients. + attr_accessor :countries + + # List of product images associated with this product (e.g. logos or images of the gift cards) + attr_accessor :images + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'description' => :'description', + :'category' => :'category', + :'disclosure' => :'disclosure', + :'skus' => :'skus', + :'currency_codes' => :'currency_codes', + :'countries' => :'countries', + :'images' => :'images' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'description' => :'String', + :'category' => :'String', + :'disclosure' => :'String', + :'skus' => :'Array', + :'currency_codes' => :'Array', + :'countries' => :'Array', + :'images' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Product` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + else + self.id = nil + end + + if attributes.key?(:'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?(:'category') + self.category = attributes[:'category'] + else + self.category = nil + end + + if attributes.key?(:'disclosure') + self.disclosure = attributes[:'disclosure'] + else + self.disclosure = nil + end + + if attributes.key?(:'skus') + if (value = attributes[:'skus']).is_a?(Array) + self.skus = value + end + end + + if attributes.key?(:'currency_codes') + if (value = attributes[:'currency_codes']).is_a?(Array) + self.currency_codes = value + end + else + self.currency_codes = nil + end + + if attributes.key?(:'countries') + if (value = attributes[:'countries']).is_a?(Array) + self.countries = value + end + else + self.countries = nil + end + + if attributes.key?(:'images') + if (value = attributes[:'images']).is_a?(Array) + self.images = value + end + else + self.images = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + 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 + + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @description.nil? + invalid_properties.push('invalid value for "description", description cannot be nil.') + end + + if @category.nil? + invalid_properties.push('invalid value for "category", category cannot be nil.') + end + + if @disclosure.nil? + invalid_properties.push('invalid value for "disclosure", disclosure cannot be nil.') + end + + if @currency_codes.nil? + invalid_properties.push('invalid value for "currency_codes", currency_codes cannot be nil.') + end + + if @currency_codes.length < 1 + invalid_properties.push('invalid value for "currency_codes", number of items must be greater than or equal to 1.') + end + + if @countries.nil? + invalid_properties.push('invalid value for "countries", countries cannot be nil.') + end + + if @countries.length < 1 + invalid_properties.push('invalid value for "countries", number of items must be greater than or equal to 1.') + end + + if @images.nil? + invalid_properties.push('invalid value for "images", images cannot be nil.') + end + + if @images.length < 0 + invalid_properties.push('invalid value for "images", number of items 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 @id.nil? + return false if @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @name.nil? + return false if @description.nil? + return false if @category.nil? + category_validator = EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + return false unless category_validator.valid?(@category) + return false if @disclosure.nil? + return false if @currency_codes.nil? + return false if @currency_codes.length < 1 + return false if @countries.nil? + return false if @countries.length < 1 + return false if @images.nil? + return false if @images.length < 0 + 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 checking allowed values (enum). + # @param [Object] category Object to be assigned + def category=(category) + validator = EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + unless validator.valid?(category) + fail ArgumentError, "invalid value for \"category\", must be one of #{validator.allowable_values}." + end + @category = category + end + + # Custom attribute writer method with validation + # @param [Object] countries Value to be assigned + def countries=(countries) + if countries.nil? + fail ArgumentError, 'countries cannot be nil' + end + + if countries.length < 1 + fail ArgumentError, 'invalid value for "countries", number of items must be greater than or equal to 1.' + end + + @countries = countries + end + + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length < 0 + fail ArgumentError, 'invalid value for "images", number of items must be greater than or equal to 0.' + end + + @images = images + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + description == o.description && + category == o.category && + disclosure == o.disclosure && + skus == o.skus && + currency_codes == o.currency_codes && + countries == o.countries && + images == o.images + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, description, category, disclosure, skus, currency_codes, countries, images].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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/recipient.rb b/lib/tremendous/models/recipient.rb new file mode 100644 index 0000000..47929f7 --- /dev/null +++ b/lib/tremendous/models/recipient.rb @@ -0,0 +1,236 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details of the recipient of the reward + class Recipient + # Name of the recipient + attr_accessor :name + + # Email address of the recipient + attr_accessor :email + + # Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +). + attr_accessor :phone + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'email' => :'email', + :'phone' => :'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 + { + :'name' => :'String', + :'email' => :'String', + :'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::Recipient` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Recipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'phone') + self.phone = attributes[:'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 && + name == o.name && + email == o.email && + phone == o.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 + [name, email, 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/refund_details.rb b/lib/tremendous/models/refund_details.rb new file mode 100644 index 0000000..12d25d2 --- /dev/null +++ b/lib/tremendous/models/refund_details.rb @@ -0,0 +1,241 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class RefundDetails + # Total amount of the order refunds (in USD) + attr_accessor :total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'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::RefundDetails` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RefundDetails`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + else + self.total = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @total.nil? + invalid_properties.push('invalid value for "total", total cannot be nil.') + end + + if @total < 0 + invalid_properties.push('invalid value for "total", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @total.nil? + return false if @total < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] total Value to be assigned + def total=(total) + if total.nil? + fail ArgumentError, 'total cannot be nil' + end + + if total < 0 + fail ArgumentError, 'invalid value for "total", must be greater than or equal to 0.' + end + + @total = total + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_reward422_response.rb b/lib/tremendous/models/resend_reward422_response.rb new file mode 100644 index 0000000..a484651 --- /dev/null +++ b/lib/tremendous/models/resend_reward422_response.rb @@ -0,0 +1,221 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class ResendReward422Response + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'errors' => :'ListRewards401ResponseErrors' + } + 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::ResendReward422Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::ResendReward422Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + else + self.errors = 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 @errors.nil? + invalid_properties.push('invalid value for "errors", errors 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 @errors.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 && + errors == o.errors + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [errors].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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.rb b/lib/tremendous/models/reward.rb new file mode 100644 index 0000000..ba41b31 --- /dev/null +++ b/lib/tremendous/models/reward.rb @@ -0,0 +1,406 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 Reward + # 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'RewardWithoutLinkDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::Reward` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::Reward`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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 new file mode 100644 index 0000000..5df5abb --- /dev/null +++ b/lib/tremendous/models/reward_base.rb @@ -0,0 +1,397 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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 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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardBase` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardBase`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = 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 + 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 + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_custom_fields_inner.rb b/lib/tremendous/models/reward_base_custom_fields_inner.rb new file mode 100644 index 0000000..e21e913 --- /dev/null +++ b/lib/tremendous/models/reward_base_custom_fields_inner.rb @@ -0,0 +1,248 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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 RewardBaseCustomFieldsInner + # Tremendous ID of the custom field + attr_accessor :id + + # Value of the custom field + attr_accessor :value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'value' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardBaseCustomFieldsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardBaseCustomFieldsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_for_order_create.rb b/lib/tremendous/models/reward_for_order_create.rb new file mode 100644 index 0000000..8a27588 --- /dev/null +++ b/lib/tremendous/models/reward_for_order_create.rb @@ -0,0 +1,416 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + # Set this to translate the redemption experience for this reward. Pass a 2-letter [ISO-639-1 code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) for the desired language. Defaults to `en`. + attr_accessor :language + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'language' => :'language', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'language' => :'String', + :'delivery' => :'CreateOrderRequestRewardDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardForOrderCreate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardForOrderCreate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + language == o.language && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, language, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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 new file mode 100644 index 0000000..c0a2cbb --- /dev/null +++ b/lib/tremendous/models/reward_link.rb @@ -0,0 +1,247 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +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. + attr_accessor :link + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'link' => :'link' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'link' => :'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::RewardLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + link == o.link + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_token.rb b/lib/tremendous/models/reward_token.rb new file mode 100644 index 0000000..94c47de --- /dev/null +++ b/lib/tremendous/models/reward_token.rb @@ -0,0 +1,257 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # The redemption token for a reward. + class RewardToken + # Tremendous ID of the reward + attr_accessor :id + + # The token to redeem the reward. + attr_accessor :token + + # Date the token expires + attr_accessor :expires_at + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'token' => :'token', + :'expires_at' => :'expires_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'token' => :'String', + :'expires_at' => :'Time' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardToken` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardToken`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'token') + self.token = attributes[:'token'] + end + + if attributes.key?(:'expires_at') + self.expires_at = attributes[:'expires_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + token == o.token && + expires_at == o.expires_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, token, expires_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_value.rb b/lib/tremendous/models/reward_value.rb new file mode 100644 index 0000000..a2c0e15 --- /dev/null +++ b/lib/tremendous/models/reward_value.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + 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 + { + :'denomination' => :'denomination', + :'currency_code' => :'currency_code' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'denomination' => :'Float', + :'currency_code' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardValue` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardValue`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'denomination') + self.denomination = attributes[:'denomination'] + else + self.denomination = nil + end + + if attributes.key?(:'currency_code') + self.currency_code = attributes[:'currency_code'] + else + self.currency_code = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @denomination.nil? + invalid_properties.push('invalid value for "denomination", denomination cannot be nil.') + end + + if @currency_code.nil? + invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @denomination.nil? + return false if @currency_code.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) + return true if self.equal?(o) + self.class == o.class && + denomination == o.denomination && + currency_code == o.currency_code + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [denomination, currency_code].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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_with_link.rb b/lib/tremendous/models/reward_with_link.rb new file mode 100644 index 0000000..b2c3a79 --- /dev/null +++ b/lib/tremendous/models/reward_with_link.rb @@ -0,0 +1,406 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'RewardWithLinkDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardWithLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardWithLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_with_link_delivery.rb b/lib/tremendous/models/reward_with_link_delivery.rb new file mode 100644 index 0000000..95f98f8 --- /dev/null +++ b/lib/tremendous/models/reward_with_link_delivery.rb @@ -0,0 +1,296 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class RewardWithLinkDelivery + # 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. Only available for rewards for which the `method` for delivery is set to `LINK`. + attr_accessor :link + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status', + :'link' => :'link' + } + end + + # 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' => :'String', + :'status' => :'String', + :'link' => :'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::RewardWithLinkDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardWithLinkDelivery`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = nil + end + + if attributes.key?(:'link') + self.link = attributes[:'link'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status && + link == o.link + end + + # @see the `==` method + # @param [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, status, link].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_without_link.rb b/lib/tremendous/models/reward_without_link.rb new file mode 100644 index 0000000..847a8e9 --- /dev/null +++ b/lib/tremendous/models/reward_without_link.rb @@ -0,0 +1,406 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +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. + attr_accessor :products + + attr_accessor :value + + attr_accessor :recipient + + # Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored. + attr_accessor :deliver_at + + attr_accessor :custom_fields + + attr_accessor :delivery + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'order_id' => :'order_id', + :'created_at' => :'created_at', + :'campaign_id' => :'campaign_id', + :'products' => :'products', + :'value' => :'value', + :'recipient' => :'recipient', + :'deliver_at' => :'deliver_at', + :'custom_fields' => :'custom_fields', + :'delivery' => :'delivery' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'order_id' => :'String', + :'created_at' => :'Time', + :'campaign_id' => :'String', + :'products' => :'Array', + :'value' => :'ListRewards200ResponseRewardsInnerValue', + :'recipient' => :'ListRewards200ResponseRewardsInnerRecipient', + :'deliver_at' => :'Date', + :'custom_fields' => :'Array', + :'delivery' => :'RewardWithoutLinkDelivery' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'campaign_id', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::RewardWithoutLink` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardWithoutLink`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'campaign_id') + self.campaign_id = attributes[:'campaign_id'] + end + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'recipient') + self.recipient = attributes[:'recipient'] + end + + if attributes.key?(:'deliver_at') + self.deliver_at = attributes[:'deliver_at'] + end + + if attributes.key?(:'custom_fields') + if (value = attributes[:'custom_fields']).is_a?(Array) + self.custom_fields = value + end + end + + if attributes.key?(:'delivery') + self.delivery = attributes[:'delivery'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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(/[A-Z0-9]{4,20}/) + if !@id.nil? && @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 !@order_id.nil? && @order_id !~ pattern + invalid_properties.push("invalid value for \"order_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}.") + end + + if !@products.nil? && @products.length < 1 + invalid_properties.push('invalid value for "products", number of items must be greater than or equal to 1.') + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if !@deliver_at.nil? && @deliver_at !~ pattern + invalid_properties.push("invalid value for \"deliver_at\", 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' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if !@order_id.nil? && @order_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 !@products.nil? && @products.length < 1 + return false if !@deliver_at.nil? && @deliver_at !~ Regexp.new(/YYYY-MM-DD/) + 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] order_id Value to be assigned + def order_id=(order_id) + if order_id.nil? + fail ArgumentError, 'order_id cannot be nil' + end + + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if order_id !~ pattern + fail ArgumentError, "invalid value for \"order_id\", must conform to the pattern #{pattern}." + end + + @order_id = order_id + end + + # Custom attribute writer method with validation + # @param [Object] campaign_id Value to be assigned + def campaign_id=(campaign_id) + pattern = Regexp.new(/[A-Z0-9]{4,20}/) + if !campaign_id.nil? && campaign_id !~ pattern + fail ArgumentError, "invalid value for \"campaign_id\", must conform to the pattern #{pattern}." + end + + @campaign_id = campaign_id + end + + # Custom attribute writer method with validation + # @param [Object] products Value to be assigned + def products=(products) + if products.nil? + fail ArgumentError, 'products cannot be nil' + end + + if products.length < 1 + fail ArgumentError, 'invalid value for "products", number of items must be greater than or equal to 1.' + end + + @products = products + end + + # Custom attribute writer method with validation + # @param [Object] deliver_at Value to be assigned + def deliver_at=(deliver_at) + if deliver_at.nil? + fail ArgumentError, 'deliver_at cannot be nil' + end + + pattern = Regexp.new(/YYYY-MM-DD/) + if deliver_at !~ pattern + fail ArgumentError, "invalid value for \"deliver_at\", must conform to the pattern #{pattern}." + end + + @deliver_at = deliver_at + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + order_id == o.order_id && + created_at == o.created_at && + campaign_id == o.campaign_id && + products == o.products && + value == o.value && + recipient == o.recipient && + deliver_at == o.deliver_at && + custom_fields == o.custom_fields && + delivery == o.delivery + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, order_id, created_at, campaign_id, products, value, recipient, deliver_at, custom_fields, delivery].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.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_without_link_delivery.rb b/lib/tremendous/models/reward_without_link_delivery.rb new file mode 100644 index 0000000..f1b4690 --- /dev/null +++ b/lib/tremendous/models/reward_without_link_delivery.rb @@ -0,0 +1,286 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + # Details on how the reward is delivered to the recipient. + class RewardWithoutLinkDelivery + # 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 + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + 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', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'method' => :'String', + :'status' => :'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::RewardWithoutLinkDelivery` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::RewardWithoutLinkDelivery`. Please check the name 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'] + else + self.method = nil + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + else + self.status = 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 @method.nil? + invalid_properties.push('invalid value for "method", method cannot be nil.') + end + + if @status.nil? + invalid_properties.push('invalid value for "status", status cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @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) + return true if self.equal?(o) + self.class == o.class && + method == o.method && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [method, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/simulate_webhook_request.rb b/lib/tremendous/models/simulate_webhook_request.rb new file mode 100644 index 0000000..be204ad --- /dev/null +++ b/lib/tremendous/models/simulate_webhook_request.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class SimulateWebhookRequest + # The event to test. See the [List events endpoint reference](/reference/get_webhooks-id-events) for all available events. + attr_accessor :event + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'event' => :'event' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'event' => :'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::SimulateWebhookRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::SimulateWebhookRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'event') + self.event = attributes[:'event'] + else + self.event = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return 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 @event.nil? + invalid_properties.push('invalid value for "event", event cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @event.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + event == o.event + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [event].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/webhook.rb b/lib/tremendous/models/webhook.rb new file mode 100644 index 0000000..909f1d6 --- /dev/null +++ b/lib/tremendous/models/webhook.rb @@ -0,0 +1,262 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class Webhook + attr_accessor :id + + # URL the webhook will make requests to + attr_accessor :url + + # Private key for the webhook + attr_accessor :private_key + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'url' => :'url', + :'private_key' => :'private_key' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'url' => :'String', + :'private_key' => :'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::Webhook` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::Webhook`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + + if attributes.key?(:'private_key') + self.private_key = attributes[:'private_key'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + 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 + + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/) + return false if @url.nil? + 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) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + url == o.url && + private_key == o.private_key + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, url, private_key].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/webhook_post.rb b/lib/tremendous/models/webhook_post.rb new file mode 100644 index 0000000..a7647b9 --- /dev/null +++ b/lib/tremendous/models/webhook_post.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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module Tremendous + class WebhookPost + # URL the webhook will make requests to + attr_accessor :url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'url' => :'url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::WebhookPost` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.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::WebhookPost`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'url') + self.url = attributes[:'url'] + else + self.url = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @url.nil? + invalid_properties.push('invalid value for "url", url cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @url.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + url == o.url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = 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/version.rb b/lib/tremendous/version.rb new file mode 100644 index 0000000..87cea38 --- /dev/null +++ b/lib/tremendous/version.rb @@ -0,0 +1,3 @@ +module Tremendous + VERSION = "5.0.0" +end diff --git a/spec/api/balance_transactions_api_spec.rb b/spec/api/balance_transactions_api_spec.rb new file mode 100644 index 0000000..ab4b4b5 --- /dev/null +++ b/spec/api/balance_transactions_api_spec.rb @@ -0,0 +1,50 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::BalanceTransactionsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'BalanceTransactionsApi' do + before do + # run before each test + @api_instance = Tremendous::BalanceTransactionsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of BalanceTransactionsApi' do + it 'should create an instance of BalanceTransactionsApi' do + expect(@api_instance).to be_instance_of(Tremendous::BalanceTransactionsApi) + end + end + + # unit tests for list_balance_transactions + # List balance transactions + # Fetch a list of all balance transactions on your account. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of transactions. The returned transactions are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of transactions listed. The default value is 10. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @return [ListBalanceTransactions200Response] + describe 'list_balance_transactions test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/campaigns_api_spec.rb b/spec/api/campaigns_api_spec.rb new file mode 100644 index 0000000..cac0558 --- /dev/null +++ b/spec/api/campaigns_api_spec.rb @@ -0,0 +1,58 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::CampaignsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CampaignsApi' do + before do + # run before each test + @api_instance = Tremendous::CampaignsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CampaignsApi' do + it 'should create an instance of CampaignsApi' do + expect(@api_instance).to be_instance_of(Tremendous::CampaignsApi) + end + end + + # unit tests for get_campaign + # Retrieve campaign + # Retrieve a campaign, identified by the given `id` in the URL + # @param id ID of the campaign that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetCampaign200Response] + describe 'get_campaign test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_campaigns + # List campaigns + # Retrieve a list of all campaigns created in your account + # @param [Hash] opts the optional parameters + # @return [ListCampaigns200Response] + describe 'list_campaigns test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/fields_api_spec.rb b/spec/api/fields_api_spec.rb new file mode 100644 index 0000000..cf64fb8 --- /dev/null +++ b/spec/api/fields_api_spec.rb @@ -0,0 +1,46 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::FieldsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'FieldsApi' do + before do + # run before each test + @api_instance = Tremendous::FieldsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of FieldsApi' do + it 'should create an instance of FieldsApi' do + expect(@api_instance).to be_instance_of(Tremendous::FieldsApi) + end + end + + # unit tests for list_fields + # List fields + # For reporting and analytics purposes, custom fields can be associated with rewards generated through the API. Custom fields must be first added by members of your admin team through the Tremendous Dashboard. + # @param [Hash] opts the optional parameters + # @return [ListFields200Response] + describe 'list_fields test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/funding_sources_api_spec.rb b/spec/api/funding_sources_api_spec.rb new file mode 100644 index 0000000..ba9187f --- /dev/null +++ b/spec/api/funding_sources_api_spec.rb @@ -0,0 +1,58 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::FundingSourcesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'FundingSourcesApi' do + before do + # run before each test + @api_instance = Tremendous::FundingSourcesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of FundingSourcesApi' do + it 'should create an instance of FundingSourcesApi' do + expect(@api_instance).to be_instance_of(Tremendous::FundingSourcesApi) + end + end + + # unit tests for get_funding_source + # Retrieve funding source + # Retrieve a funding source, identified by the given `id` in the URL + # @param id ID of the funding source that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetFundingSource200Response] + describe 'get_funding_source test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_funding_sources + # List funding sources + # Retrieve a list of all funding sources available for ordering through the API in your organization's account. + # @param [Hash] opts the optional parameters + # @return [ListFundingSources200Response] + describe 'list_funding_sources test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/invoices_api_spec.rb b/spec/api/invoices_api_spec.rb new file mode 100644 index 0000000..0eaa45d --- /dev/null +++ b/spec/api/invoices_api_spec.rb @@ -0,0 +1,108 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::InvoicesApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InvoicesApi' do + before do + # run before each test + @api_instance = Tremendous::InvoicesApi.new + end + + after do + # run after each test + end + + describe 'test an instance of InvoicesApi' do + it 'should create an instance of InvoicesApi' do + expect(@api_instance).to be_instance_of(Tremendous::InvoicesApi) + end + end + + # unit tests for create_invoice + # 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> + # @param create_invoice_request Invoice details + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + describe 'create_invoice test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for delete_invoices + # Delete invoice + # Removes an invoice. This has no further consequences but is a rather cosmetic operation. + # @param id ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + describe 'delete_invoices test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for download_invoice_csv + # Retrieve invoice as CSV + # Generates a CSV version for an invoice listing the associated rewards and orders + # @param id ID of the Invoice for that the CSV should be generated + # @param [Hash] opts the optional parameters + # @return [String] + describe 'download_invoice_csv test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for download_invoice_pdf + # Retrieve invoice as PDF + # Generates a PDF version for an invoice + # @param id ID of the Invoice for that the PDF should be generated + # @param [Hash] opts the optional parameters + # @return [File] + describe 'download_invoice_pdf test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_invoice + # Retrieve invoice + # Retrieve an invoice, identified by the given `id` in the URL > 📘 Deleted Invoices > > This endpoint can be used to retrieve details on deleted invoices > that the list of invoices omits. + # @param id ID of the invoice that should be retrieved + # @param [Hash] opts the optional parameters + # @return [CreateInvoice200Response] + describe 'get_invoice test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_invoices + # List invoices + # Fetch a list of all invoices on your account. > 🚧 Deleted invoices are omitted > > The response does not include any previously deleted invoices. + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of invoices. The returned invoices are ordered (and offsetted) by their creation date (DESC). + # @option opts [Integer] :limit Limits the number of invoices listed. The maximum and default value is 10. + # @return [ListInvoices200Response] + describe 'list_invoices test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/members_api_spec.rb b/spec/api/members_api_spec.rb new file mode 100644 index 0000000..2a72d41 --- /dev/null +++ b/spec/api/members_api_spec.rb @@ -0,0 +1,69 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::MembersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'MembersApi' do + before do + # run before each test + @api_instance = Tremendous::MembersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of MembersApi' do + it 'should create an instance of MembersApi' do + expect(@api_instance).to be_instance_of(Tremendous::MembersApi) + end + end + + # unit tests for create_member + # 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 one of two roles that determine their permissions within the organization: 1. `MEMBER`: Limited permissions. Can view their own reward and order histories only. 2. `ADMIN`: Update organization settings, invite other members to the organization, and view all member order and reward histories within their organization. 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 Member details + # @param [Hash] opts the optional parameters + # @return [CreateMember200Response] + describe 'create_member test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_member + # Retrieve member + # @param id ID of the member to retrieve + # @param [Hash] opts the optional parameters + # @return [GetMember200Response] + describe 'get_member test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_members + # List members + # To list members of a sub-organization [create an API key for that organization](/reference/post_organizations-id-create-api-key) first, then use the new API key in the list members request. + # @param [Hash] opts the optional parameters + # @return [ListMembers200Response] + describe 'list_members test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/orders_api_spec.rb b/spec/api/orders_api_spec.rb new file mode 100644 index 0000000..b50b9b2 --- /dev/null +++ b/spec/api/orders_api_spec.rb @@ -0,0 +1,100 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::OrdersApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrdersApi' do + before do + # run before each test + @api_instance = Tremendous::OrdersApi.new + end + + after do + # run after each test + end + + describe 'test an instance of OrdersApi' do + it 'should create an instance of OrdersApi' do + expect(@api_instance).to be_instance_of(Tremendous::OrdersApi) + end + end + + # unit tests for approve_order + # Approve order + # 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 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] + describe 'approve_order test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for create_order + # 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> </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. + # @param create_order_request Order to create + # @param [Hash] opts the optional parameters + # @return [CreateOrder200Response] + describe 'create_order test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_order + # Retrieve order + # Retrieve the order, identified by the given `id` in the URL + # @param id 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] + describe 'get_order test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_orders + # List orders + # Retrieve a list of orders + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of orders. The returned orders are ordered (and offsetted) by their creation date (DESC). + # @option opts [String] :campaign_id Only return results with a matching campaign_id. + # @option opts [String] :external_id Only return results with a matching external_id. + # @option opts [String] :created_at_gte Only return results where the created_at field is greater than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [String] :created_at_lte Only return results where the created_at field is less than or equal to the supplied value. The string needs to be an ISO 8601 datetime. + # @option opts [Integer] :limit Limits the number of orders listed. The maximum value is 100 and the default is 10. + # @return [ListOrders200Response] + describe 'list_orders test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for reject_order + # Reject order + # 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 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] + describe 'reject_order test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/organizations_api_spec.rb b/spec/api/organizations_api_spec.rb new file mode 100644 index 0000000..beb2d4a --- /dev/null +++ b/spec/api/organizations_api_spec.rb @@ -0,0 +1,80 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::OrganizationsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'OrganizationsApi' do + before do + # run before each test + @api_instance = Tremendous::OrganizationsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of OrganizationsApi' do + it 'should create an instance of OrganizationsApi' do + expect(@api_instance).to be_instance_of(Tremendous::OrganizationsApi) + end + end + + # unit tests for create_api_key + # Create API key + # Creates a new API key. The API key used to make the request will remain active. Created API keys are generated randomly and returned in the response. **You cannot retrieve them again.** + # @param [Hash] opts the optional parameters + # @return [CreateApiKey200Response] + describe 'create_api_key test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for create_organization + # 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 Organization details + # @param [Hash] opts the optional parameters + # @return [CreateOrganization200Response] + describe 'create_organization test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_organization + # Retrieve organization + # @param id ID of the organization to retrieve + # @param [Hash] opts the optional parameters + # @return [GetOrganization200Response] + describe 'get_organization test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_organizations + # List organizations + # The returned list only includes the organization to which the API key belongs to, that is used for the request. + # @param [Hash] opts the optional parameters + # @return [ListOrganizations200Response] + describe 'list_organizations test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/products_api_spec.rb b/spec/api/products_api_spec.rb new file mode 100644 index 0000000..e16ee4a --- /dev/null +++ b/spec/api/products_api_spec.rb @@ -0,0 +1,60 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::ProductsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProductsApi' do + before do + # run before each test + @api_instance = Tremendous::ProductsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ProductsApi' do + it 'should create an instance of ProductsApi' do + expect(@api_instance).to be_instance_of(Tremendous::ProductsApi) + end + end + + # unit tests for get_product + # Retrieve product + # Retrieve a product, identified by the given `id` in the URL + # @param id ID of the product that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetProduct200Response] + describe 'get_product test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_products + # List products + # Retrieve a list of available products + # @param [Hash] opts the optional parameters + # @option opts [String] :country Comma-separated list of [Alpha-2 country codes](https://www.iban.com/country-codes), used to only retrieve products available in the provided countries + # @option opts [String] :currency Comma-separated list of [currency codes](https://www.iban.com/currency-codes), used to only retrieve products available in the provided currencies + # @return [ListProducts200Response] + describe 'list_products test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/rewards_api_spec.rb b/spec/api/rewards_api_spec.rb new file mode 100644 index 0000000..147c3d1 --- /dev/null +++ b/spec/api/rewards_api_spec.rb @@ -0,0 +1,95 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::RewardsApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'RewardsApi' do + before do + # run before each test + @api_instance = Tremendous::RewardsApi.new + end + + after do + # run after each test + end + + describe 'test an instance of RewardsApi' do + it 'should create an instance of RewardsApi' do + expect(@api_instance).to be_instance_of(Tremendous::RewardsApi) + end + end + + # unit tests for generate_reward_link + # Generate a reward URL + # Generate a redemption link for the reward identified by the `id` in the URL + # @param id ID of the reward + # @param [Hash] opts the optional parameters + # @return [GenerateRewardLink200Response] + describe 'generate_reward_link test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for generate_reward_token + # Generate a reward token + # Generate a temporary reward token identified by the `id` in the URL. These tokens are needed to render a reward when using [Tremendous Embed](https://github.com/tremendous-rewards/embed/blob/master/docs/documentation.md). The token is valid for 24 hours. + # @param id ID of the reward + # @param [Hash] opts the optional parameters + # @return [GenerateRewardToken200Response] + describe 'generate_reward_token test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_reward + # Retrieve single reward + # Retrieve the reward, identified by the given `id` in the URL + # @param id ID of the reward that should be retrieved + # @param [Hash] opts the optional parameters + # @return [GetReward200Response] + describe 'get_reward test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_rewards + # List rewards + # Retrieve a list of all created rewards + # @param [Hash] opts the optional parameters + # @option opts [Integer] :offset Offsets the returned list by the given number of rewards. The returned rewards are ordered (and offsetted) by their creation date (DESC). + # @return [ListRewards200Response] + describe 'list_rewards test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for resend_reward + # Resend reward + # Resends a reward, identified by the given `id` in the URL, to its recipient. + # @param id ID of the reward that should be resent + # @param [Hash] opts the optional parameters + # @return [Object] + describe 'resend_reward test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/webhooks_api_spec.rb b/spec/api/webhooks_api_spec.rb new file mode 100644 index 0000000..bba9e2e --- /dev/null +++ b/spec/api/webhooks_api_spec.rb @@ -0,0 +1,95 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for Tremendous::WebhooksApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'WebhooksApi' do + before do + # run before each test + @api_instance = Tremendous::WebhooksApi.new + end + + after do + # run after each test + end + + describe 'test an instance of WebhooksApi' do + it 'should create an instance of WebhooksApi' do + expect(@api_instance).to be_instance_of(Tremendous::WebhooksApi) + end + end + + # unit tests for create_webhook + # 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 Webhook details + # @param [Hash] opts the optional parameters + # @return [CreateWebhook200Response] + describe 'create_webhook test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_webhook + # Retrieve webhook + # > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id ID of the webhook to retrieve + # @param [Hash] opts the optional parameters + # @return [CreateWebhook200Response] + describe 'get_webhook test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_webhook_events + # List events + # Lists all event types that can be sent to the configured webhook endpoint. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id ID of the webhook to list the events for + # @param [Hash] opts the optional parameters + # @return [ListWebhookEvents200Response] + describe 'list_webhook_events test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for list_webhooks + # List webhooks + # Every organization can only have one webhook. This endpoint shows the details about that webhook. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param [Hash] opts the optional parameters + # @return [ListWebhooks200Response] + describe 'list_webhooks test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for simulate_webhook + # Test webhook + # Making a request to this endpoint will cause our system to trigger a webhook for the specified event. This can be very useful when testing the setup that processes webhooks on your end. > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1) + # @param id ID of the webhook to test + # @param simulate_webhook_request Webhook details + # @param [Hash] opts the optional parameters + # @return [String] + describe 'simulate_webhook test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/balance_transaction_spec.rb b/spec/models/balance_transaction_spec.rb new file mode 100644 index 0000000..95b4fb4 --- /dev/null +++ b/spec/models/balance_transaction_spec.rb @@ -0,0 +1,60 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::BalanceTransaction +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::BalanceTransaction do + let(:instance) { Tremendous::BalanceTransaction.new } + + describe 'test an instance of BalanceTransaction' do + it 'should create an instance of BalanceTransaction' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::BalanceTransaction) + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "balance"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "action"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/campaign_spec.rb b/spec/models/campaign_spec.rb new file mode 100644 index 0000000..f214cd2 --- /dev/null +++ b/spec/models/campaign_spec.rb @@ -0,0 +1,54 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Campaign +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Campaign do + let(:instance) { Tremendous::Campaign.new } + + describe 'test an instance of Campaign' do + it 'should create an instance of Campaign' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Campaign) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_api_key200_response_spec.rb b/spec/models/create_api_key200_response_spec.rb new file mode 100644 index 0000000..7ef6324 --- /dev/null +++ b/spec/models/create_api_key200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateApiKey200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateApiKey200Response do + let(:instance) { Tremendous::CreateApiKey200Response.new } + + describe 'test an instance of CreateApiKey200Response' do + it 'should create an instance of CreateApiKey200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateApiKey200Response) + end + end + + describe 'test attribute "api_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_invoice200_response_spec.rb b/spec/models/create_invoice200_response_spec.rb new file mode 100644 index 0000000..0981fce --- /dev/null +++ b/spec/models/create_invoice200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateInvoice200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateInvoice200Response do + let(:instance) { Tremendous::CreateInvoice200Response.new } + + describe 'test an instance of CreateInvoice200Response' do + it 'should create an instance of CreateInvoice200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateInvoice200Response) + end + end + + describe 'test attribute "invoice"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_invoice_request_spec.rb b/spec/models/create_invoice_request_spec.rb new file mode 100644 index 0000000..c3da712 --- /dev/null +++ b/spec/models/create_invoice_request_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateInvoiceRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateInvoiceRequest do + let(:instance) { Tremendous::CreateInvoiceRequest.new } + + describe 'test an instance of CreateInvoiceRequest' do + it 'should create an instance of CreateInvoiceRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateInvoiceRequest) + end + end + + describe 'test attribute "po_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_invoice_spec.rb b/spec/models/create_invoice_spec.rb new file mode 100644 index 0000000..fba3641 --- /dev/null +++ b/spec/models/create_invoice_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateInvoice +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateInvoice do + let(:instance) { Tremendous::CreateInvoice.new } + + describe 'test an instance of CreateInvoice' do + it 'should create an instance of CreateInvoice' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateInvoice) + end + end + + describe 'test attribute "po_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_member200_response_spec.rb b/spec/models/create_member200_response_spec.rb new file mode 100644 index 0000000..be23ac0 --- /dev/null +++ b/spec/models/create_member200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateMember200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateMember200Response do + let(:instance) { Tremendous::CreateMember200Response.new } + + describe 'test an instance of CreateMember200Response' do + it 'should create an instance of CreateMember200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateMember200Response) + end + end + + describe 'test attribute "member"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_member_request_spec.rb b/spec/models/create_member_request_spec.rb new file mode 100644 index 0000000..c3e0e0e --- /dev/null +++ b/spec/models/create_member_request_spec.rb @@ -0,0 +1,52 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateMemberRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateMemberRequest do + let(:instance) { Tremendous::CreateMemberRequest.new } + + describe 'test an instance of CreateMemberRequest' do + it 'should create an instance of CreateMemberRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateMemberRequest) + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/create_member_spec.rb b/spec/models/create_member_spec.rb new file mode 100644 index 0000000..3035780 --- /dev/null +++ b/spec/models/create_member_spec.rb @@ -0,0 +1,52 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateMember +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateMember do + let(:instance) { Tremendous::CreateMember.new } + + describe 'test an instance of CreateMember' do + it 'should create an instance of CreateMember' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateMember) + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/create_order200_response_order_rewards_inner_delivery_spec.rb b/spec/models/create_order200_response_order_rewards_inner_delivery_spec.rb new file mode 100644 index 0000000..aa22884 --- /dev/null +++ b/spec/models/create_order200_response_order_rewards_inner_delivery_spec.rb @@ -0,0 +1,56 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrder200ResponseOrderRewardsInnerDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrder200ResponseOrderRewardsInnerDelivery do + let(:instance) { Tremendous::CreateOrder200ResponseOrderRewardsInnerDelivery.new } + + describe 'test an instance of CreateOrder200ResponseOrderRewardsInnerDelivery' do + it 'should create an instance of CreateOrder200ResponseOrderRewardsInnerDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrder200ResponseOrderRewardsInnerDelivery) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "link"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order200_response_order_rewards_inner_spec.rb b/spec/models/create_order200_response_order_rewards_inner_spec.rb new file mode 100644 index 0000000..1efdc9c --- /dev/null +++ b/spec/models/create_order200_response_order_rewards_inner_spec.rb @@ -0,0 +1,78 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrder200ResponseOrderRewardsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrder200ResponseOrderRewardsInner do + let(:instance) { Tremendous::CreateOrder200ResponseOrderRewardsInner.new } + + describe 'test an instance of CreateOrder200ResponseOrderRewardsInner' do + it 'should create an instance of CreateOrder200ResponseOrderRewardsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrder200ResponseOrderRewardsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order200_response_order_spec.rb b/spec/models/create_order200_response_order_spec.rb new file mode 100644 index 0000000..982361e --- /dev/null +++ b/spec/models/create_order200_response_order_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrder200ResponseOrder +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrder200ResponseOrder do + let(:instance) { Tremendous::CreateOrder200ResponseOrder.new } + + describe 'test an instance of CreateOrder200ResponseOrder' do + it 'should create an instance of CreateOrder200ResponseOrder' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrder200ResponseOrder) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "rewards"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order200_response_spec.rb b/spec/models/create_order200_response_spec.rb new file mode 100644 index 0000000..012ac28 --- /dev/null +++ b/spec/models/create_order200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrder200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrder200Response do + let(:instance) { Tremendous::CreateOrder200Response.new } + + describe 'test an instance of CreateOrder200Response' do + it 'should create an instance of CreateOrder200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrder200Response) + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order201_response_spec.rb b/spec/models/create_order201_response_spec.rb new file mode 100644 index 0000000..f5d9aee --- /dev/null +++ b/spec/models/create_order201_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrder201Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrder201Response do + let(:instance) { Tremendous::CreateOrder201Response.new } + + describe 'test an instance of CreateOrder201Response' do + it 'should create an instance of CreateOrder201Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrder201Response) + end + end + + describe 'test attribute "order"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order_request_payment_spec.rb b/spec/models/create_order_request_payment_spec.rb new file mode 100644 index 0000000..6076ff8 --- /dev/null +++ b/spec/models/create_order_request_payment_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrderRequestPayment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrderRequestPayment do + let(:instance) { Tremendous::CreateOrderRequestPayment.new } + + describe 'test an instance of CreateOrderRequestPayment' do + it 'should create an instance of CreateOrderRequestPayment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrderRequestPayment) + end + end + + describe 'test attribute "funding_source_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order_request_reward_delivery_spec.rb b/spec/models/create_order_request_reward_delivery_spec.rb new file mode 100644 index 0000000..76abb5e --- /dev/null +++ b/spec/models/create_order_request_reward_delivery_spec.rb @@ -0,0 +1,40 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrderRequestRewardDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrderRequestRewardDelivery do + let(:instance) { Tremendous::CreateOrderRequestRewardDelivery.new } + + describe 'test an instance of CreateOrderRequestRewardDelivery' do + it 'should create an instance of CreateOrderRequestRewardDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrderRequestRewardDelivery) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/create_order_request_reward_spec.rb b/spec/models/create_order_request_reward_spec.rb new file mode 100644 index 0000000..e66efa6 --- /dev/null +++ b/spec/models/create_order_request_reward_spec.rb @@ -0,0 +1,78 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrderRequestReward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrderRequestReward do + let(:instance) { Tremendous::CreateOrderRequestReward.new } + + describe 'test an instance of CreateOrderRequestReward' do + it 'should create an instance of CreateOrderRequestReward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrderRequestReward) + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "language"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_order_request_spec.rb b/spec/models/create_order_request_spec.rb new file mode 100644 index 0000000..fa1ca26 --- /dev/null +++ b/spec/models/create_order_request_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrderRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrderRequest do + let(:instance) { Tremendous::CreateOrderRequest.new } + + describe 'test an instance of CreateOrderRequest' do + it 'should create an instance of CreateOrderRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrderRequest) + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_organization200_response_organization_spec.rb b/spec/models/create_organization200_response_organization_spec.rb new file mode 100644 index 0000000..c2ad9f0 --- /dev/null +++ b/spec/models/create_organization200_response_organization_spec.rb @@ -0,0 +1,70 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrganization200ResponseOrganization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrganization200ResponseOrganization do + let(:instance) { Tremendous::CreateOrganization200ResponseOrganization.new } + + describe 'test an instance of CreateOrganization200ResponseOrganization' do + it 'should create an instance of CreateOrganization200ResponseOrganization' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrganization200ResponseOrganization) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "website"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "api_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_organization200_response_spec.rb b/spec/models/create_organization200_response_spec.rb new file mode 100644 index 0000000..92c5d67 --- /dev/null +++ b/spec/models/create_organization200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrganization200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrganization200Response do + let(:instance) { Tremendous::CreateOrganization200Response.new } + + describe 'test an instance of CreateOrganization200Response' do + it 'should create an instance of CreateOrganization200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrganization200Response) + end + end + + describe 'test attribute "organization"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_organization_request_copy_settings_spec.rb b/spec/models/create_organization_request_copy_settings_spec.rb new file mode 100644 index 0000000..ed7d65e --- /dev/null +++ b/spec/models/create_organization_request_copy_settings_spec.rb @@ -0,0 +1,66 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrganizationRequestCopySettings +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrganizationRequestCopySettings do + let(:instance) { Tremendous::CreateOrganizationRequestCopySettings.new } + + describe 'test an instance of CreateOrganizationRequestCopySettings' do + it 'should create an instance of CreateOrganizationRequestCopySettings' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrganizationRequestCopySettings) + end + end + + describe 'test attribute "campaigns"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_approvals"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment_methods"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "security_settings"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "users"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_organization_request_spec.rb b/spec/models/create_organization_request_spec.rb new file mode 100644 index 0000000..3b41ce1 --- /dev/null +++ b/spec/models/create_organization_request_spec.rb @@ -0,0 +1,60 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrganizationRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrganizationRequest do + let(:instance) { Tremendous::CreateOrganizationRequest.new } + + describe 'test an instance of CreateOrganizationRequest' do + it 'should create an instance of CreateOrganizationRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrganizationRequest) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "website"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "with_api_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "copy_settings"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "phone"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_organization_spec.rb b/spec/models/create_organization_spec.rb new file mode 100644 index 0000000..31b096b --- /dev/null +++ b/spec/models/create_organization_spec.rb @@ -0,0 +1,60 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateOrganization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateOrganization do + let(:instance) { Tremendous::CreateOrganization.new } + + describe 'test an instance of CreateOrganization' do + it 'should create an instance of CreateOrganization' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateOrganization) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "website"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "with_api_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "copy_settings"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "phone"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_webhook200_response_spec.rb b/spec/models/create_webhook200_response_spec.rb new file mode 100644 index 0000000..3f50e28 --- /dev/null +++ b/spec/models/create_webhook200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateWebhook200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateWebhook200Response do + let(:instance) { Tremendous::CreateWebhook200Response.new } + + describe 'test an instance of CreateWebhook200Response' do + it 'should create an instance of CreateWebhook200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateWebhook200Response) + end + end + + describe 'test attribute "webhook"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/create_webhook_request_spec.rb b/spec/models/create_webhook_request_spec.rb new file mode 100644 index 0000000..8b68cae --- /dev/null +++ b/spec/models/create_webhook_request_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CreateWebhookRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CreateWebhookRequest do + let(:instance) { Tremendous::CreateWebhookRequest.new } + + describe 'test an instance of CreateWebhookRequest' do + it 'should create an instance of CreateWebhookRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CreateWebhookRequest) + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/currency_codes_spec.rb b/spec/models/currency_codes_spec.rb new file mode 100644 index 0000000..0b151f9 --- /dev/null +++ b/spec/models/currency_codes_spec.rb @@ -0,0 +1,30 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CurrencyCodes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CurrencyCodes do + let(:instance) { Tremendous::CurrencyCodes.new } + + describe 'test an instance of CurrencyCodes' do + it 'should create an instance of CurrencyCodes' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CurrencyCodes) + end + end + +end diff --git a/spec/models/custom_field_spec.rb b/spec/models/custom_field_spec.rb new file mode 100644 index 0000000..511678f --- /dev/null +++ b/spec/models/custom_field_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::CustomField +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::CustomField do + let(:instance) { Tremendous::CustomField.new } + + describe 'test an instance of CustomField' do + it 'should create an instance of CustomField' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::CustomField) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/delivery_details_spec.rb b/spec/models/delivery_details_spec.rb new file mode 100644 index 0000000..304d4ff --- /dev/null +++ b/spec/models/delivery_details_spec.rb @@ -0,0 +1,50 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::DeliveryDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::DeliveryDetails do + let(:instance) { Tremendous::DeliveryDetails.new } + + describe 'test an instance of DeliveryDetails' do + it 'should create an instance of DeliveryDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::DeliveryDetails) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/delivery_details_with_link_spec.rb b/spec/models/delivery_details_with_link_spec.rb new file mode 100644 index 0000000..1864cdf --- /dev/null +++ b/spec/models/delivery_details_with_link_spec.rb @@ -0,0 +1,56 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::DeliveryDetailsWithLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::DeliveryDetailsWithLink do + let(:instance) { Tremendous::DeliveryDetailsWithLink.new } + + describe 'test an instance of DeliveryDetailsWithLink' do + it 'should create an instance of DeliveryDetailsWithLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::DeliveryDetailsWithLink) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "link"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/delivery_method_spec.rb b/spec/models/delivery_method_spec.rb new file mode 100644 index 0000000..64f8896 --- /dev/null +++ b/spec/models/delivery_method_spec.rb @@ -0,0 +1,30 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::DeliveryMethod +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::DeliveryMethod do + let(:instance) { Tremendous::DeliveryMethod.new } + + describe 'test an instance of DeliveryMethod' do + it 'should create an instance of DeliveryMethod' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::DeliveryMethod) + end + end + +end diff --git a/spec/models/delivery_status_spec.rb b/spec/models/delivery_status_spec.rb new file mode 100644 index 0000000..4da76c3 --- /dev/null +++ b/spec/models/delivery_status_spec.rb @@ -0,0 +1,30 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::DeliveryStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::DeliveryStatus do + let(:instance) { Tremendous::DeliveryStatus.new } + + describe 'test an instance of DeliveryStatus' do + it 'should create an instance of DeliveryStatus' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::DeliveryStatus) + end + end + +end diff --git a/spec/models/error_model_spec.rb b/spec/models/error_model_spec.rb new file mode 100644 index 0000000..66db1b0 --- /dev/null +++ b/spec/models/error_model_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ErrorModel +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ErrorModel do + let(:instance) { Tremendous::ErrorModel.new } + + describe 'test an instance of ErrorModel' do + it 'should create an instance of ErrorModel' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ErrorModel) + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/field_spec.rb b/spec/models/field_spec.rb new file mode 100644 index 0000000..c29fefc --- /dev/null +++ b/spec/models/field_spec.rb @@ -0,0 +1,66 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Field +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Field do + let(:instance) { Tremendous::Field.new } + + describe 'test an instance of Field' do + it 'should create an instance of Field' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Field) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "label"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "data_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "required"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "scope"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/funding_source_spec.rb b/spec/models/funding_source_spec.rb new file mode 100644 index 0000000..b0c81a2 --- /dev/null +++ b/spec/models/funding_source_spec.rb @@ -0,0 +1,62 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::FundingSource +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::FundingSource do + let(:instance) { Tremendous::FundingSource.new } + + describe 'test an instance of FundingSource' do + it 'should create an instance of FundingSource' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::FundingSource) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + # validator.allowable_values.each do |value| + # expect { instance.type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/generate_reward_link200_response_reward_spec.rb b/spec/models/generate_reward_link200_response_reward_spec.rb new file mode 100644 index 0000000..cd27e02 --- /dev/null +++ b/spec/models/generate_reward_link200_response_reward_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GenerateRewardLink200ResponseReward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GenerateRewardLink200ResponseReward do + let(:instance) { Tremendous::GenerateRewardLink200ResponseReward.new } + + describe 'test an instance of GenerateRewardLink200ResponseReward' do + it 'should create an instance of GenerateRewardLink200ResponseReward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GenerateRewardLink200ResponseReward) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "link"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/generate_reward_link200_response_spec.rb b/spec/models/generate_reward_link200_response_spec.rb new file mode 100644 index 0000000..f376278 --- /dev/null +++ b/spec/models/generate_reward_link200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GenerateRewardLink200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GenerateRewardLink200Response do + let(:instance) { Tremendous::GenerateRewardLink200Response.new } + + describe 'test an instance of GenerateRewardLink200Response' do + it 'should create an instance of GenerateRewardLink200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GenerateRewardLink200Response) + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/generate_reward_link403_response_spec.rb b/spec/models/generate_reward_link403_response_spec.rb new file mode 100644 index 0000000..9386235 --- /dev/null +++ b/spec/models/generate_reward_link403_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GenerateRewardLink403Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GenerateRewardLink403Response do + let(:instance) { Tremendous::GenerateRewardLink403Response.new } + + describe 'test an instance of GenerateRewardLink403Response' do + it 'should create an instance of GenerateRewardLink403Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GenerateRewardLink403Response) + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/generate_reward_token200_response_reward_spec.rb b/spec/models/generate_reward_token200_response_reward_spec.rb new file mode 100644 index 0000000..e382840 --- /dev/null +++ b/spec/models/generate_reward_token200_response_reward_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GenerateRewardToken200ResponseReward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GenerateRewardToken200ResponseReward do + let(:instance) { Tremendous::GenerateRewardToken200ResponseReward.new } + + describe 'test an instance of GenerateRewardToken200ResponseReward' do + it 'should create an instance of GenerateRewardToken200ResponseReward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GenerateRewardToken200ResponseReward) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "token"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expires_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/generate_reward_token200_response_spec.rb b/spec/models/generate_reward_token200_response_spec.rb new file mode 100644 index 0000000..b8d9d97 --- /dev/null +++ b/spec/models/generate_reward_token200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GenerateRewardToken200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GenerateRewardToken200Response do + let(:instance) { Tremendous::GenerateRewardToken200Response.new } + + describe 'test an instance of GenerateRewardToken200Response' do + it 'should create an instance of GenerateRewardToken200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GenerateRewardToken200Response) + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_campaign200_response_spec.rb b/spec/models/get_campaign200_response_spec.rb new file mode 100644 index 0000000..00af2b0 --- /dev/null +++ b/spec/models/get_campaign200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetCampaign200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetCampaign200Response do + let(:instance) { Tremendous::GetCampaign200Response.new } + + describe 'test an instance of GetCampaign200Response' do + it 'should create an instance of GetCampaign200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetCampaign200Response) + end + end + + describe 'test attribute "campaign"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_funding_source200_response_spec.rb b/spec/models/get_funding_source200_response_spec.rb new file mode 100644 index 0000000..098ed32 --- /dev/null +++ b/spec/models/get_funding_source200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetFundingSource200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetFundingSource200Response do + let(:instance) { Tremendous::GetFundingSource200Response.new } + + describe 'test an instance of GetFundingSource200Response' do + it 'should create an instance of GetFundingSource200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetFundingSource200Response) + end + end + + describe 'test attribute "funding_source"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_member200_response_member_events_inner_spec.rb b/spec/models/get_member200_response_member_events_inner_spec.rb new file mode 100644 index 0000000..df22c4a --- /dev/null +++ b/spec/models/get_member200_response_member_events_inner_spec.rb @@ -0,0 +1,46 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetMember200ResponseMemberEventsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetMember200ResponseMemberEventsInner do + let(:instance) { Tremendous::GetMember200ResponseMemberEventsInner.new } + + describe 'test an instance of GetMember200ResponseMemberEventsInner' do + it 'should create an instance of GetMember200ResponseMemberEventsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetMember200ResponseMemberEventsInner) + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["created", "last_login"]) + # validator.allowable_values.each do |value| + # expect { instance.type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "date_utc"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_member200_response_member_spec.rb b/spec/models/get_member200_response_member_spec.rb new file mode 100644 index 0000000..7e2cfa7 --- /dev/null +++ b/spec/models/get_member200_response_member_spec.rb @@ -0,0 +1,74 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetMember200ResponseMember +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetMember200ResponseMember do + let(:instance) { Tremendous::GetMember200ResponseMember.new } + + describe 'test an instance of GetMember200ResponseMember' do + it 'should create an instance of GetMember200ResponseMember' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetMember200ResponseMember) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_member200_response_spec.rb b/spec/models/get_member200_response_spec.rb new file mode 100644 index 0000000..0c19b66 --- /dev/null +++ b/spec/models/get_member200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetMember200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetMember200Response do + let(:instance) { Tremendous::GetMember200Response.new } + + describe 'test an instance of GetMember200Response' do + it 'should create an instance of GetMember200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetMember200Response) + end + end + + describe 'test attribute "member"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_organization200_response_spec.rb b/spec/models/get_organization200_response_spec.rb new file mode 100644 index 0000000..6967005 --- /dev/null +++ b/spec/models/get_organization200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetOrganization200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetOrganization200Response do + let(:instance) { Tremendous::GetOrganization200Response.new } + + describe 'test an instance of GetOrganization200Response' do + it 'should create an instance of GetOrganization200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetOrganization200Response) + end + end + + describe 'test attribute "organization"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product200_response_spec.rb b/spec/models/get_product200_response_spec.rb new file mode 100644 index 0000000..49e26d1 --- /dev/null +++ b/spec/models/get_product200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetProduct200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetProduct200Response do + let(:instance) { Tremendous::GetProduct200Response.new } + + describe 'test an instance of GetProduct200Response' do + it 'should create an instance of GetProduct200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetProduct200Response) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_reward200_response_spec.rb b/spec/models/get_reward200_response_spec.rb new file mode 100644 index 0000000..49889d7 --- /dev/null +++ b/spec/models/get_reward200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::GetReward200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::GetReward200Response do + let(:instance) { Tremendous::GetReward200Response.new } + + describe 'test an instance of GetReward200Response' do + it 'should create an instance of GetReward200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::GetReward200Response) + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/invoice_spec.rb b/spec/models/invoice_spec.rb new file mode 100644 index 0000000..2d91c87 --- /dev/null +++ b/spec/models/invoice_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Invoice +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Invoice do + let(:instance) { Tremendous::Invoice.new } + + describe 'test an instance of Invoice' do + it 'should create an instance of Invoice' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Invoice) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "po_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "orders"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "rewards"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_balance_transactions200_response_invoices_inner_spec.rb b/spec/models/list_balance_transactions200_response_invoices_inner_spec.rb new file mode 100644 index 0000000..f8a2e66 --- /dev/null +++ b/spec/models/list_balance_transactions200_response_invoices_inner_spec.rb @@ -0,0 +1,60 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListBalanceTransactions200ResponseInvoicesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListBalanceTransactions200ResponseInvoicesInner do + let(:instance) { Tremendous::ListBalanceTransactions200ResponseInvoicesInner.new } + + describe 'test an instance of ListBalanceTransactions200ResponseInvoicesInner' do + it 'should create an instance of ListBalanceTransactions200ResponseInvoicesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListBalanceTransactions200ResponseInvoicesInner) + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "balance"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "action"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_balance_transactions200_response_spec.rb b/spec/models/list_balance_transactions200_response_spec.rb new file mode 100644 index 0000000..ead7c95 --- /dev/null +++ b/spec/models/list_balance_transactions200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListBalanceTransactions200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListBalanceTransactions200Response do + let(:instance) { Tremendous::ListBalanceTransactions200Response.new } + + describe 'test an instance of ListBalanceTransactions200Response' do + it 'should create an instance of ListBalanceTransactions200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListBalanceTransactions200Response) + end + end + + describe 'test attribute "invoices"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_campaigns200_response_campaigns_inner_spec.rb b/spec/models/list_campaigns200_response_campaigns_inner_spec.rb new file mode 100644 index 0000000..acfde6d --- /dev/null +++ b/spec/models/list_campaigns200_response_campaigns_inner_spec.rb @@ -0,0 +1,54 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListCampaigns200ResponseCampaignsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListCampaigns200ResponseCampaignsInner do + let(:instance) { Tremendous::ListCampaigns200ResponseCampaignsInner.new } + + describe 'test an instance of ListCampaigns200ResponseCampaignsInner' do + it 'should create an instance of ListCampaigns200ResponseCampaignsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListCampaigns200ResponseCampaignsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_campaigns200_response_spec.rb b/spec/models/list_campaigns200_response_spec.rb new file mode 100644 index 0000000..7195278 --- /dev/null +++ b/spec/models/list_campaigns200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListCampaigns200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListCampaigns200Response do + let(:instance) { Tremendous::ListCampaigns200Response.new } + + describe 'test an instance of ListCampaigns200Response' do + it 'should create an instance of ListCampaigns200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListCampaigns200Response) + end + end + + describe 'test attribute "campaigns"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_fields200_response_fields_inner_spec.rb b/spec/models/list_fields200_response_fields_inner_spec.rb new file mode 100644 index 0000000..8471ebb --- /dev/null +++ b/spec/models/list_fields200_response_fields_inner_spec.rb @@ -0,0 +1,66 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListFields200ResponseFieldsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListFields200ResponseFieldsInner do + let(:instance) { Tremendous::ListFields200ResponseFieldsInner.new } + + describe 'test an instance of ListFields200ResponseFieldsInner' do + it 'should create an instance of ListFields200ResponseFieldsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListFields200ResponseFieldsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "label"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "data_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "data"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "required"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "scope"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_fields200_response_spec.rb b/spec/models/list_fields200_response_spec.rb new file mode 100644 index 0000000..1985fdc --- /dev/null +++ b/spec/models/list_fields200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListFields200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListFields200Response do + let(:instance) { Tremendous::ListFields200Response.new } + + describe 'test an instance of ListFields200Response' do + it 'should create an instance of ListFields200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListFields200Response) + end + end + + describe 'test attribute "fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_funding_sources200_response_funding_sources_inner_meta_spec.rb b/spec/models/list_funding_sources200_response_funding_sources_inner_meta_spec.rb new file mode 100644 index 0000000..8911448 --- /dev/null +++ b/spec/models/list_funding_sources200_response_funding_sources_inner_meta_spec.rb @@ -0,0 +1,110 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta do + let(:instance) { Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta.new } + + describe 'test an instance of ListFundingSources200ResponseFundingSourcesInnerMeta' do + it 'should create an instance of ListFundingSources200ResponseFundingSourcesInnerMeta' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListFundingSources200ResponseFundingSourcesInnerMeta) + end + end + + describe 'test attribute "available_cents"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pending_cents"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "accountholder_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["checking", "savings"]) + # validator.allowable_values.each do |value| + # expect { instance.account_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "bank_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_number_mask"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_routing_mask"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "refundable"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "network"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MasterCard", "Amex", "JCB", "Diner's Club", "visa", "discover", "laser", "elo", "maestro", "solo"]) + # validator.allowable_values.each do |value| + # expect { instance.network = value }.not_to raise_error + # end + end + end + + describe 'test attribute "last4"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expired"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_payment_failed_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_funding_sources200_response_funding_sources_inner_spec.rb b/spec/models/list_funding_sources200_response_funding_sources_inner_spec.rb new file mode 100644 index 0000000..1eb5b71 --- /dev/null +++ b/spec/models/list_funding_sources200_response_funding_sources_inner_spec.rb @@ -0,0 +1,62 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListFundingSources200ResponseFundingSourcesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListFundingSources200ResponseFundingSourcesInner do + let(:instance) { Tremendous::ListFundingSources200ResponseFundingSourcesInner.new } + + describe 'test an instance of ListFundingSources200ResponseFundingSourcesInner' do + it 'should create an instance of ListFundingSources200ResponseFundingSourcesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListFundingSources200ResponseFundingSourcesInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["balance", "bank_account", "credit_card", "invoice"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["COMMERCIAL", "PRO_FORMA", "PREFUNDING_ONLY"]) + # validator.allowable_values.each do |value| + # expect { instance.type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_funding_sources200_response_spec.rb b/spec/models/list_funding_sources200_response_spec.rb new file mode 100644 index 0000000..787e18c --- /dev/null +++ b/spec/models/list_funding_sources200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListFundingSources200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListFundingSources200Response do + let(:instance) { Tremendous::ListFundingSources200Response.new } + + describe 'test an instance of ListFundingSources200Response' do + it 'should create an instance of ListFundingSources200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListFundingSources200Response) + end + end + + describe 'test attribute "funding_sources"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_invoices200_response_invoices_inner_spec.rb b/spec/models/list_invoices200_response_invoices_inner_spec.rb new file mode 100644 index 0000000..9d9afc6 --- /dev/null +++ b/spec/models/list_invoices200_response_invoices_inner_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListInvoices200ResponseInvoicesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListInvoices200ResponseInvoicesInner do + let(:instance) { Tremendous::ListInvoices200ResponseInvoicesInner.new } + + describe 'test an instance of ListInvoices200ResponseInvoicesInner' do + it 'should create an instance of ListInvoices200ResponseInvoicesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListInvoices200ResponseInvoicesInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "po_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["DELETED", "PAID", "OPEN", "MARKED_AS_PAID"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "orders"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "rewards"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_invoices200_response_spec.rb b/spec/models/list_invoices200_response_spec.rb new file mode 100644 index 0000000..7ea510e --- /dev/null +++ b/spec/models/list_invoices200_response_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListInvoices200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListInvoices200Response do + let(:instance) { Tremendous::ListInvoices200Response.new } + + describe 'test an instance of ListInvoices200Response' do + it 'should create an instance of ListInvoices200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListInvoices200Response) + end + end + + describe 'test attribute "invoices"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_count"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_members200_response_members_inner_spec.rb b/spec/models/list_members200_response_members_inner_spec.rb new file mode 100644 index 0000000..a979731 --- /dev/null +++ b/spec/models/list_members200_response_members_inner_spec.rb @@ -0,0 +1,80 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListMembers200ResponseMembersInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListMembers200ResponseMembersInner do + let(:instance) { Tremendous::ListMembers200ResponseMembersInner.new } + + describe 'test an instance of ListMembers200ResponseMembersInner' do + it 'should create an instance of ListMembers200ResponseMembersInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListMembers200ResponseMembersInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_login_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_members200_response_spec.rb b/spec/models/list_members200_response_spec.rb new file mode 100644 index 0000000..9f395c2 --- /dev/null +++ b/spec/models/list_members200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListMembers200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListMembers200Response do + let(:instance) { Tremendous::ListMembers200Response.new } + + describe 'test an instance of ListMembers200Response' do + it 'should create an instance of ListMembers200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListMembers200Response) + end + end + + describe 'test attribute "members"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_orders200_response_orders_inner_payment_refund_spec.rb b/spec/models/list_orders200_response_orders_inner_payment_refund_spec.rb new file mode 100644 index 0000000..7ae8efb --- /dev/null +++ b/spec/models/list_orders200_response_orders_inner_payment_refund_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrders200ResponseOrdersInnerPaymentRefund +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrders200ResponseOrdersInnerPaymentRefund do + let(:instance) { Tremendous::ListOrders200ResponseOrdersInnerPaymentRefund.new } + + describe 'test an instance of ListOrders200ResponseOrdersInnerPaymentRefund' do + it 'should create an instance of ListOrders200ResponseOrdersInnerPaymentRefund' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrders200ResponseOrdersInnerPaymentRefund) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_orders200_response_orders_inner_payment_spec.rb b/spec/models/list_orders200_response_orders_inner_payment_spec.rb new file mode 100644 index 0000000..06640cf --- /dev/null +++ b/spec/models/list_orders200_response_orders_inner_payment_spec.rb @@ -0,0 +1,64 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrders200ResponseOrdersInnerPayment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrders200ResponseOrdersInnerPayment do + let(:instance) { Tremendous::ListOrders200ResponseOrdersInnerPayment.new } + + describe 'test an instance of ListOrders200ResponseOrdersInnerPayment' do + it 'should create an instance of ListOrders200ResponseOrdersInnerPayment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrders200ResponseOrdersInnerPayment) + end + end + + describe 'test attribute "subtotal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fees"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "refund"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "channel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) + # validator.allowable_values.each do |value| + # expect { instance.channel = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/list_orders200_response_orders_inner_spec.rb b/spec/models/list_orders200_response_orders_inner_spec.rb new file mode 100644 index 0000000..1755dea --- /dev/null +++ b/spec/models/list_orders200_response_orders_inner_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrders200ResponseOrdersInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrders200ResponseOrdersInner do + let(:instance) { Tremendous::ListOrders200ResponseOrdersInner.new } + + describe 'test an instance of ListOrders200ResponseOrdersInner' do + it 'should create an instance of ListOrders200ResponseOrdersInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrders200ResponseOrdersInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_orders200_response_spec.rb b/spec/models/list_orders200_response_spec.rb new file mode 100644 index 0000000..f0c2a91 --- /dev/null +++ b/spec/models/list_orders200_response_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrders200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrders200Response do + let(:instance) { Tremendous::ListOrders200Response.new } + + describe 'test an instance of ListOrders200Response' do + it 'should create an instance of ListOrders200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrders200Response) + end + end + + describe 'test attribute "orders"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_count"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_organizations200_response_organizations_inner_spec.rb b/spec/models/list_organizations200_response_organizations_inner_spec.rb new file mode 100644 index 0000000..dfc6c58 --- /dev/null +++ b/spec/models/list_organizations200_response_organizations_inner_spec.rb @@ -0,0 +1,64 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrganizations200ResponseOrganizationsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrganizations200ResponseOrganizationsInner do + let(:instance) { Tremendous::ListOrganizations200ResponseOrganizationsInner.new } + + describe 'test an instance of ListOrganizations200ResponseOrganizationsInner' do + it 'should create an instance of ListOrganizations200ResponseOrganizationsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrganizations200ResponseOrganizationsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "website"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_organizations200_response_spec.rb b/spec/models/list_organizations200_response_spec.rb new file mode 100644 index 0000000..a959903 --- /dev/null +++ b/spec/models/list_organizations200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListOrganizations200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListOrganizations200Response do + let(:instance) { Tremendous::ListOrganizations200Response.new } + + describe 'test an instance of ListOrganizations200Response' do + it 'should create an instance of ListOrganizations200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListOrganizations200Response) + end + end + + describe 'test attribute "organizations"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_products200_response_products_inner_countries_inner_spec.rb b/spec/models/list_products200_response_products_inner_countries_inner_spec.rb new file mode 100644 index 0000000..35c1ef2 --- /dev/null +++ b/spec/models/list_products200_response_products_inner_countries_inner_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListProducts200ResponseProductsInnerCountriesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListProducts200ResponseProductsInnerCountriesInner do + let(:instance) { Tremendous::ListProducts200ResponseProductsInnerCountriesInner.new } + + describe 'test an instance of ListProducts200ResponseProductsInnerCountriesInner' do + it 'should create an instance of ListProducts200ResponseProductsInnerCountriesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListProducts200ResponseProductsInnerCountriesInner) + end + end + + describe 'test attribute "abbr"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_products200_response_products_inner_images_inner_spec.rb b/spec/models/list_products200_response_products_inner_images_inner_spec.rb new file mode 100644 index 0000000..ecba941 --- /dev/null +++ b/spec/models/list_products200_response_products_inner_images_inner_spec.rb @@ -0,0 +1,46 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListProducts200ResponseProductsInnerImagesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListProducts200ResponseProductsInnerImagesInner do + let(:instance) { Tremendous::ListProducts200ResponseProductsInnerImagesInner.new } + + describe 'test an instance of ListProducts200ResponseProductsInnerImagesInner' do + it 'should create an instance of ListProducts200ResponseProductsInnerImagesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListProducts200ResponseProductsInnerImagesInner) + end + end + + describe 'test attribute "src"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["card", "logo"]) + # validator.allowable_values.each do |value| + # expect { instance.type = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/list_products200_response_products_inner_skus_inner_spec.rb b/spec/models/list_products200_response_products_inner_skus_inner_spec.rb new file mode 100644 index 0000000..c348c3b --- /dev/null +++ b/spec/models/list_products200_response_products_inner_skus_inner_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListProducts200ResponseProductsInnerSkusInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListProducts200ResponseProductsInnerSkusInner do + let(:instance) { Tremendous::ListProducts200ResponseProductsInnerSkusInner.new } + + describe 'test an instance of ListProducts200ResponseProductsInnerSkusInner' do + it 'should create an instance of ListProducts200ResponseProductsInnerSkusInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListProducts200ResponseProductsInnerSkusInner) + end + end + + describe 'test attribute "min"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_products200_response_products_inner_spec.rb b/spec/models/list_products200_response_products_inner_spec.rb new file mode 100644 index 0000000..2d3d2c5 --- /dev/null +++ b/spec/models/list_products200_response_products_inner_spec.rb @@ -0,0 +1,92 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListProducts200ResponseProductsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListProducts200ResponseProductsInner do + let(:instance) { Tremendous::ListProducts200ResponseProductsInner.new } + + describe 'test an instance of ListProducts200ResponseProductsInner' do + it 'should create an instance of ListProducts200ResponseProductsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListProducts200ResponseProductsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + # validator.allowable_values.each do |value| + # expect { instance.category = value }.not_to raise_error + # end + end + end + + describe 'test attribute "disclosure"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "skus"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "currency_codes"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', ["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"]) + # validator.allowable_values.each do |value| + # expect { instance.currency_codes = value }.not_to raise_error + # end + end + end + + describe 'test attribute "countries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_products200_response_spec.rb b/spec/models/list_products200_response_spec.rb new file mode 100644 index 0000000..1901804 --- /dev/null +++ b/spec/models/list_products200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListProducts200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListProducts200Response do + let(:instance) { Tremendous::ListProducts200Response.new } + + describe 'test an instance of ListProducts200Response' do + it 'should create an instance of ListProducts200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListProducts200Response) + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards200_response_rewards_inner_custom_fields_inner_spec.rb b/spec/models/list_rewards200_response_rewards_inner_custom_fields_inner_spec.rb new file mode 100644 index 0000000..4de109e --- /dev/null +++ b/spec/models/list_rewards200_response_rewards_inner_custom_fields_inner_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner do + let(:instance) { Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner.new } + + describe 'test an instance of ListRewards200ResponseRewardsInnerCustomFieldsInner' do + it 'should create an instance of ListRewards200ResponseRewardsInnerCustomFieldsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200ResponseRewardsInnerCustomFieldsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards200_response_rewards_inner_delivery_spec.rb b/spec/models/list_rewards200_response_rewards_inner_delivery_spec.rb new file mode 100644 index 0000000..4ed14bb --- /dev/null +++ b/spec/models/list_rewards200_response_rewards_inner_delivery_spec.rb @@ -0,0 +1,50 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200ResponseRewardsInnerDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200ResponseRewardsInnerDelivery do + let(:instance) { Tremendous::ListRewards200ResponseRewardsInnerDelivery.new } + + describe 'test an instance of ListRewards200ResponseRewardsInnerDelivery' do + it 'should create an instance of ListRewards200ResponseRewardsInnerDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200ResponseRewardsInnerDelivery) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/list_rewards200_response_rewards_inner_recipient_spec.rb b/spec/models/list_rewards200_response_rewards_inner_recipient_spec.rb new file mode 100644 index 0000000..58f5e79 --- /dev/null +++ b/spec/models/list_rewards200_response_rewards_inner_recipient_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200ResponseRewardsInnerRecipient +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200ResponseRewardsInnerRecipient do + let(:instance) { Tremendous::ListRewards200ResponseRewardsInnerRecipient.new } + + describe 'test an instance of ListRewards200ResponseRewardsInnerRecipient' do + it 'should create an instance of ListRewards200ResponseRewardsInnerRecipient' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200ResponseRewardsInnerRecipient) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "phone"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards200_response_rewards_inner_spec.rb b/spec/models/list_rewards200_response_rewards_inner_spec.rb new file mode 100644 index 0000000..32994ec --- /dev/null +++ b/spec/models/list_rewards200_response_rewards_inner_spec.rb @@ -0,0 +1,78 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200ResponseRewardsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200ResponseRewardsInner do + let(:instance) { Tremendous::ListRewards200ResponseRewardsInner.new } + + describe 'test an instance of ListRewards200ResponseRewardsInner' do + it 'should create an instance of ListRewards200ResponseRewardsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200ResponseRewardsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards200_response_rewards_inner_value_spec.rb b/spec/models/list_rewards200_response_rewards_inner_value_spec.rb new file mode 100644 index 0000000..0df8d34 --- /dev/null +++ b/spec/models/list_rewards200_response_rewards_inner_value_spec.rb @@ -0,0 +1,46 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200ResponseRewardsInnerValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200ResponseRewardsInnerValue do + let(:instance) { Tremendous::ListRewards200ResponseRewardsInnerValue.new } + + describe 'test an instance of ListRewards200ResponseRewardsInnerValue' do + it 'should create an instance of ListRewards200ResponseRewardsInnerValue' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200ResponseRewardsInnerValue) + end + end + + describe 'test attribute "denomination"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "currency_code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::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"]) + # validator.allowable_values.each do |value| + # expect { instance.currency_code = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/list_rewards200_response_spec.rb b/spec/models/list_rewards200_response_spec.rb new file mode 100644 index 0000000..da862b8 --- /dev/null +++ b/spec/models/list_rewards200_response_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards200Response do + let(:instance) { Tremendous::ListRewards200Response.new } + + describe 'test an instance of ListRewards200Response' do + it 'should create an instance of ListRewards200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards200Response) + end + end + + describe 'test attribute "rewards"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_count"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards401_response_errors_spec.rb b/spec/models/list_rewards401_response_errors_spec.rb new file mode 100644 index 0000000..fb6eb38 --- /dev/null +++ b/spec/models/list_rewards401_response_errors_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards401ResponseErrors +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards401ResponseErrors do + let(:instance) { Tremendous::ListRewards401ResponseErrors.new } + + describe 'test an instance of ListRewards401ResponseErrors' do + it 'should create an instance of ListRewards401ResponseErrors' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards401ResponseErrors) + end + end + + describe 'test attribute "message"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payload"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards401_response_spec.rb b/spec/models/list_rewards401_response_spec.rb new file mode 100644 index 0000000..bb180cf --- /dev/null +++ b/spec/models/list_rewards401_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards401Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards401Response do + let(:instance) { Tremendous::ListRewards401Response.new } + + describe 'test an instance of ListRewards401Response' do + it 'should create an instance of ListRewards401Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards401Response) + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_rewards429_response_spec.rb b/spec/models/list_rewards429_response_spec.rb new file mode 100644 index 0000000..5bbf8aa --- /dev/null +++ b/spec/models/list_rewards429_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListRewards429Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListRewards429Response do + let(:instance) { Tremendous::ListRewards429Response.new } + + describe 'test an instance of ListRewards429Response' do + it 'should create an instance of ListRewards429Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListRewards429Response) + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_webhook_events200_response_spec.rb b/spec/models/list_webhook_events200_response_spec.rb new file mode 100644 index 0000000..11c1839 --- /dev/null +++ b/spec/models/list_webhook_events200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListWebhookEvents200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListWebhookEvents200Response do + let(:instance) { Tremendous::ListWebhookEvents200Response.new } + + describe 'test an instance of ListWebhookEvents200Response' do + it 'should create an instance of ListWebhookEvents200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListWebhookEvents200Response) + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_webhooks200_response_spec.rb b/spec/models/list_webhooks200_response_spec.rb new file mode 100644 index 0000000..dc04896 --- /dev/null +++ b/spec/models/list_webhooks200_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListWebhooks200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListWebhooks200Response do + let(:instance) { Tremendous::ListWebhooks200Response.new } + + describe 'test an instance of ListWebhooks200Response' do + it 'should create an instance of ListWebhooks200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListWebhooks200Response) + end + end + + describe 'test attribute "webhooks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/list_webhooks200_response_webhooks_inner_spec.rb b/spec/models/list_webhooks200_response_webhooks_inner_spec.rb new file mode 100644 index 0000000..65e942f --- /dev/null +++ b/spec/models/list_webhooks200_response_webhooks_inner_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ListWebhooks200ResponseWebhooksInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ListWebhooks200ResponseWebhooksInner do + let(:instance) { Tremendous::ListWebhooks200ResponseWebhooksInner.new } + + describe 'test an instance of ListWebhooks200ResponseWebhooksInner' do + it 'should create an instance of ListWebhooks200ResponseWebhooksInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ListWebhooks200ResponseWebhooksInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "private_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/member_base_spec.rb b/spec/models/member_base_spec.rb new file mode 100644 index 0000000..5a4d53f --- /dev/null +++ b/spec/models/member_base_spec.rb @@ -0,0 +1,68 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::MemberBase +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::MemberBase do + let(:instance) { Tremendous::MemberBase.new } + + describe 'test an instance of MemberBase' do + it 'should create an instance of MemberBase' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::MemberBase) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb new file mode 100644 index 0000000..422aab2 --- /dev/null +++ b/spec/models/member_spec.rb @@ -0,0 +1,80 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Member +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Member do + let(:instance) { Tremendous::Member.new } + + describe 'test an instance of Member' do + it 'should create an instance of Member' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Member) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_login_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/member_with_events_spec.rb b/spec/models/member_with_events_spec.rb new file mode 100644 index 0000000..aab3693 --- /dev/null +++ b/spec/models/member_with_events_spec.rb @@ -0,0 +1,74 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::MemberWithEvents +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::MemberWithEvents do + let(:instance) { Tremendous::MemberWithEvents.new } + + describe 'test an instance of MemberWithEvents' do + it 'should create an instance of MemberWithEvents' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::MemberWithEvents) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "events"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/member_without_events_spec.rb b/spec/models/member_without_events_spec.rb new file mode 100644 index 0000000..9f302c6 --- /dev/null +++ b/spec/models/member_without_events_spec.rb @@ -0,0 +1,80 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::MemberWithoutEvents +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::MemberWithoutEvents do + let(:instance) { Tremendous::MemberWithoutEvents.new } + + describe 'test an instance of MemberWithoutEvents' do + it 'should create an instance of MemberWithoutEvents' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::MemberWithoutEvents) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "role"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["MEMBER", "ADMIN", "DELETED"]) + # validator.allowable_values.each do |value| + # expect { instance.role = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["REGISTERED", "INVITED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_login_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_base_payment_spec.rb b/spec/models/order_base_payment_spec.rb new file mode 100644 index 0000000..77fd99e --- /dev/null +++ b/spec/models/order_base_payment_spec.rb @@ -0,0 +1,64 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderBasePayment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderBasePayment do + let(:instance) { Tremendous::OrderBasePayment.new } + + describe 'test an instance of OrderBasePayment' do + it 'should create an instance of OrderBasePayment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderBasePayment) + end + end + + describe 'test attribute "subtotal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fees"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "refund"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "channel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) + # validator.allowable_values.each do |value| + # expect { instance.channel = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/order_base_spec.rb b/spec/models/order_base_spec.rb new file mode 100644 index 0000000..fb3cbfa --- /dev/null +++ b/spec/models/order_base_spec.rb @@ -0,0 +1,76 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderBase +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderBase do + let(:instance) { Tremendous::OrderBase.new } + + describe 'test an instance of OrderBase' do + it 'should create an instance of OrderBase' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderBase) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_for_create_reward_spec.rb b/spec/models/order_for_create_reward_spec.rb new file mode 100644 index 0000000..b77dc5c --- /dev/null +++ b/spec/models/order_for_create_reward_spec.rb @@ -0,0 +1,96 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderForCreateReward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderForCreateReward do + let(:instance) { Tremendous::OrderForCreateReward.new } + + describe 'test an instance of OrderForCreateReward' do + it 'should create an instance of OrderForCreateReward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderForCreateReward) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "language"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_for_create_spec.rb b/spec/models/order_for_create_spec.rb new file mode 100644 index 0000000..aa77100 --- /dev/null +++ b/spec/models/order_for_create_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderForCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderForCreate do + let(:instance) { Tremendous::OrderForCreate.new } + + describe 'test an instance of OrderForCreate' do + it 'should create an instance of OrderForCreate' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderForCreate) + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb new file mode 100644 index 0000000..5143b22 --- /dev/null +++ b/spec/models/order_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Order +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Order do + let(:instance) { Tremendous::Order.new } + + describe 'test an instance of Order' do + it 'should create an instance of Order' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Order) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_status_spec.rb b/spec/models/order_status_spec.rb new file mode 100644 index 0000000..8914d7e --- /dev/null +++ b/spec/models/order_status_spec.rb @@ -0,0 +1,30 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderStatus +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderStatus do + let(:instance) { Tremendous::OrderStatus.new } + + describe 'test an instance of OrderStatus' do + it 'should create an instance of OrderStatus' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderStatus) + end + end + +end diff --git a/spec/models/order_with_link_rewards_inner_spec.rb b/spec/models/order_with_link_rewards_inner_spec.rb new file mode 100644 index 0000000..c4dd815 --- /dev/null +++ b/spec/models/order_with_link_rewards_inner_spec.rb @@ -0,0 +1,90 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderWithLinkRewardsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderWithLinkRewardsInner do + let(:instance) { Tremendous::OrderWithLinkRewardsInner.new } + + describe 'test an instance of OrderWithLinkRewardsInner' do + it 'should create an instance of OrderWithLinkRewardsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderWithLinkRewardsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_with_link_spec.rb b/spec/models/order_with_link_spec.rb new file mode 100644 index 0000000..b4bcd63 --- /dev/null +++ b/spec/models/order_with_link_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderWithLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderWithLink do + let(:instance) { Tremendous::OrderWithLink.new } + + describe 'test an instance of OrderWithLink' do + it 'should create an instance of OrderWithLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderWithLink) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "rewards"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_without_link_reward_spec.rb b/spec/models/order_without_link_reward_spec.rb new file mode 100644 index 0000000..4c41ec5 --- /dev/null +++ b/spec/models/order_without_link_reward_spec.rb @@ -0,0 +1,90 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderWithoutLinkReward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderWithoutLinkReward do + let(:instance) { Tremendous::OrderWithoutLinkReward.new } + + describe 'test an instance of OrderWithoutLinkReward' do + it 'should create an instance of OrderWithoutLinkReward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderWithoutLinkReward) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/order_without_link_spec.rb b/spec/models/order_without_link_spec.rb new file mode 100644 index 0000000..caf6bee --- /dev/null +++ b/spec/models/order_without_link_spec.rb @@ -0,0 +1,82 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::OrderWithoutLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::OrderWithoutLink do + let(:instance) { Tremendous::OrderWithoutLink.new } + + describe 'test an instance of OrderWithoutLink' do + it 'should create an instance of OrderWithoutLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::OrderWithoutLink) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["CANCELED", "CART", "EXECUTED", "FAILED", "PENDING APPROVAL"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "payment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "invoice_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reward"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb new file mode 100644 index 0000000..d107598 --- /dev/null +++ b/spec/models/organization_spec.rb @@ -0,0 +1,64 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Organization +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Organization do + let(:instance) { Tremendous::Organization.new } + + describe 'test an instance of Organization' do + it 'should create an instance of Organization' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Organization) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "website"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["PENDING", "APPROVED", "REJECTED"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/payment_details_refund_spec.rb b/spec/models/payment_details_refund_spec.rb new file mode 100644 index 0000000..28d05b5 --- /dev/null +++ b/spec/models/payment_details_refund_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::PaymentDetailsRefund +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::PaymentDetailsRefund do + let(:instance) { Tremendous::PaymentDetailsRefund.new } + + describe 'test an instance of PaymentDetailsRefund' do + it 'should create an instance of PaymentDetailsRefund' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::PaymentDetailsRefund) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/payment_details_spec.rb b/spec/models/payment_details_spec.rb new file mode 100644 index 0000000..095ca91 --- /dev/null +++ b/spec/models/payment_details_spec.rb @@ -0,0 +1,64 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::PaymentDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::PaymentDetails do + let(:instance) { Tremendous::PaymentDetails.new } + + describe 'test an instance of PaymentDetails' do + it 'should create an instance of PaymentDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::PaymentDetails) + end + end + + describe 'test attribute "subtotal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fees"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "refund"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "channel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["UI", "API", "EMBED", "DECIPHER", "QUALTRICS", "TYPEFORM", "SURVEY MONKEY"]) + # validator.allowable_values.each do |value| + # expect { instance.channel = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb new file mode 100644 index 0000000..0fbf590 --- /dev/null +++ b/spec/models/product_spec.rb @@ -0,0 +1,92 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Product +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Product do + let(:instance) { Tremendous::Product.new } + + describe 'test an instance of Product' do + it 'should create an instance of Product' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Product) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "description"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["ach", "charity", "merchant_card", "paypal", "venmo", "visa_card"]) + # validator.allowable_values.each do |value| + # expect { instance.category = value }.not_to raise_error + # end + end + end + + describe 'test attribute "disclosure"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "skus"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "currency_codes"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', ["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"]) + # validator.allowable_values.each do |value| + # expect { instance.currency_codes = value }.not_to raise_error + # end + end + end + + describe 'test attribute "countries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/recipient_spec.rb b/spec/models/recipient_spec.rb new file mode 100644 index 0000000..61bf0b9 --- /dev/null +++ b/spec/models/recipient_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Recipient +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Recipient do + let(:instance) { Tremendous::Recipient.new } + + describe 'test an instance of Recipient' do + it 'should create an instance of Recipient' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Recipient) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "email"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "phone"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/refund_details_spec.rb b/spec/models/refund_details_spec.rb new file mode 100644 index 0000000..fb32cf3 --- /dev/null +++ b/spec/models/refund_details_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RefundDetails +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RefundDetails do + let(:instance) { Tremendous::RefundDetails.new } + + describe 'test an instance of RefundDetails' do + it 'should create an instance of RefundDetails' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RefundDetails) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/resend_reward422_response_spec.rb b/spec/models/resend_reward422_response_spec.rb new file mode 100644 index 0000000..b79874b --- /dev/null +++ b/spec/models/resend_reward422_response_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::ResendReward422Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::ResendReward422Response do + let(:instance) { Tremendous::ResendReward422Response.new } + + describe 'test an instance of ResendReward422Response' do + it 'should create an instance of ResendReward422Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::ResendReward422Response) + end + end + + describe 'test attribute "errors"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_base_custom_fields_inner_spec.rb b/spec/models/reward_base_custom_fields_inner_spec.rb new file mode 100644 index 0000000..c5a65e3 --- /dev/null +++ b/spec/models/reward_base_custom_fields_inner_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardBaseCustomFieldsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardBaseCustomFieldsInner do + let(:instance) { Tremendous::RewardBaseCustomFieldsInner.new } + + describe 'test an instance of RewardBaseCustomFieldsInner' do + it 'should create an instance of RewardBaseCustomFieldsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardBaseCustomFieldsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_base_spec.rb b/spec/models/reward_base_spec.rb new file mode 100644 index 0000000..86e6c10 --- /dev/null +++ b/spec/models/reward_base_spec.rb @@ -0,0 +1,84 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardBase +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardBase do + let(:instance) { Tremendous::RewardBase.new } + + describe 'test an instance of RewardBase' do + it 'should create an instance of RewardBase' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardBase) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_for_order_create_spec.rb b/spec/models/reward_for_order_create_spec.rb new file mode 100644 index 0000000..53e7277 --- /dev/null +++ b/spec/models/reward_for_order_create_spec.rb @@ -0,0 +1,96 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardForOrderCreate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardForOrderCreate do + let(:instance) { Tremendous::RewardForOrderCreate.new } + + describe 'test an instance of RewardForOrderCreate' do + it 'should create an instance of RewardForOrderCreate' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardForOrderCreate) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "language"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_link_spec.rb b/spec/models/reward_link_spec.rb new file mode 100644 index 0000000..f170550 --- /dev/null +++ b/spec/models/reward_link_spec.rb @@ -0,0 +1,42 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardLink do + let(:instance) { Tremendous::RewardLink.new } + + describe 'test an instance of RewardLink' do + it 'should create an instance of RewardLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardLink) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "link"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_spec.rb b/spec/models/reward_spec.rb new file mode 100644 index 0000000..c1ac396 --- /dev/null +++ b/spec/models/reward_spec.rb @@ -0,0 +1,90 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Reward +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Reward do + let(:instance) { Tremendous::Reward.new } + + describe 'test an instance of Reward' do + it 'should create an instance of Reward' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Reward) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_token_spec.rb b/spec/models/reward_token_spec.rb new file mode 100644 index 0000000..5ed1b37 --- /dev/null +++ b/spec/models/reward_token_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardToken +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardToken do + let(:instance) { Tremendous::RewardToken.new } + + describe 'test an instance of RewardToken' do + it 'should create an instance of RewardToken' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardToken) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "token"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expires_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_value_spec.rb b/spec/models/reward_value_spec.rb new file mode 100644 index 0000000..4bc5707 --- /dev/null +++ b/spec/models/reward_value_spec.rb @@ -0,0 +1,46 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardValue +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardValue do + let(:instance) { Tremendous::RewardValue.new } + + describe 'test an instance of RewardValue' do + it 'should create an instance of RewardValue' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardValue) + end + end + + describe 'test attribute "denomination"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "currency_code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::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"]) + # validator.allowable_values.each do |value| + # expect { instance.currency_code = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/reward_with_link_delivery_spec.rb b/spec/models/reward_with_link_delivery_spec.rb new file mode 100644 index 0000000..cf6c495 --- /dev/null +++ b/spec/models/reward_with_link_delivery_spec.rb @@ -0,0 +1,56 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardWithLinkDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardWithLinkDelivery do + let(:instance) { Tremendous::RewardWithLinkDelivery.new } + + describe 'test an instance of RewardWithLinkDelivery' do + it 'should create an instance of RewardWithLinkDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardWithLinkDelivery) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "link"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_with_link_spec.rb b/spec/models/reward_with_link_spec.rb new file mode 100644 index 0000000..1a0be1b --- /dev/null +++ b/spec/models/reward_with_link_spec.rb @@ -0,0 +1,90 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardWithLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardWithLink do + let(:instance) { Tremendous::RewardWithLink.new } + + describe 'test an instance of RewardWithLink' do + it 'should create an instance of RewardWithLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardWithLink) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/reward_without_link_delivery_spec.rb b/spec/models/reward_without_link_delivery_spec.rb new file mode 100644 index 0000000..4124766 --- /dev/null +++ b/spec/models/reward_without_link_delivery_spec.rb @@ -0,0 +1,50 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardWithoutLinkDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardWithoutLinkDelivery do + let(:instance) { Tremendous::RewardWithoutLinkDelivery.new } + + describe 'test an instance of RewardWithoutLinkDelivery' do + it 'should create an instance of RewardWithoutLinkDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardWithoutLinkDelivery) + end + end + + describe 'test attribute "method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["EMAIL", "LINK", "PHONE"]) + # validator.allowable_values.each do |value| + # expect { instance.method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["SCHEDULED", "FAILED", "SUCCEEDED", "PENDING"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/reward_without_link_spec.rb b/spec/models/reward_without_link_spec.rb new file mode 100644 index 0000000..9dbf7b8 --- /dev/null +++ b/spec/models/reward_without_link_spec.rb @@ -0,0 +1,90 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::RewardWithoutLink +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::RewardWithoutLink do + let(:instance) { Tremendous::RewardWithoutLink.new } + + describe 'test an instance of RewardWithoutLink' do + it 'should create an instance of RewardWithoutLink' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::RewardWithoutLink) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "campaign_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "recipient"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "deliver_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "custom_fields"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/simulate_webhook_request_spec.rb b/spec/models/simulate_webhook_request_spec.rb new file mode 100644 index 0000000..b3b6e09 --- /dev/null +++ b/spec/models/simulate_webhook_request_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::SimulateWebhookRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::SimulateWebhookRequest do + let(:instance) { Tremendous::SimulateWebhookRequest.new } + + describe 'test an instance of SimulateWebhookRequest' do + it 'should create an instance of SimulateWebhookRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::SimulateWebhookRequest) + end + end + + describe 'test attribute "event"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/webhook_post_spec.rb b/spec/models/webhook_post_spec.rb new file mode 100644 index 0000000..9e952a8 --- /dev/null +++ b/spec/models/webhook_post_spec.rb @@ -0,0 +1,36 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::WebhookPost +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::WebhookPost do + let(:instance) { Tremendous::WebhookPost.new } + + describe 'test an instance of WebhookPost' do + it 'should create an instance of WebhookPost' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::WebhookPost) + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/webhook_spec.rb b/spec/models/webhook_spec.rb new file mode 100644 index 0000000..dc27afa --- /dev/null +++ b/spec/models/webhook_spec.rb @@ -0,0 +1,48 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Tremendous::Webhook +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe Tremendous::Webhook do + let(:instance) { Tremendous::Webhook.new } + + describe 'test an instance of Webhook' do + it 'should create an instance of Webhook' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(Tremendous::Webhook) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "private_key"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..b4672f5 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,111 @@ +=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 +OpenAPI Generator version: 7.3.0-SNAPSHOT + +=end + +# load the gem +require 'tremendous' + +# The following was generated by the `rspec --init` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true + + # Allows RSpec to persist some state between runs in order to support + # the `--only-failures` and `--next-failure` CLI options. We recommend + # you configure your source control system to ignore this file. + config.example_status_persistence_file_path = "spec/examples.txt" + + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + config.disable_monkey_patching! + + # This setting enables warnings. It's recommended, but in some cases may + # be too noisy due to issues in dependencies. + config.warnings = true + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 + + # Run specs in random order to surface order dependencies. If you find an + # order dependency and want to debug it, you can fix the order by providing + # the seed, which is printed after each run. + # --seed 1234 + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end +end diff --git a/tremendous.gemspec b/tremendous.gemspec new file mode 100644 index 0000000..4813935 --- /dev/null +++ b/tremendous.gemspec @@ -0,0 +1,25 @@ +# encoding: utf-8 +require File.expand_path('../lib/tremendous/version', __FILE__) + +Gem::Specification.new do |spec| + spec.name = "tremendous_ruby" + spec.version = Tremendous::VERSION + spec.platform = Gem::Platform::RUBY + spec.licenses = ["MIT"] + spec.homepage = "https://github.com/tremendous-rewards/tremendous-ruby" + spec.summary = "Tremendous Ruby API SDK" + spec.authors = ["Tremendous Developers"] + spec.email = ["developers@tremendous.com"] + spec.metadata = { + "documentation_uri" => "https://www.tremendous.com/docs", + "source_code_uri" => spec.homepage + } + + spec.add_runtime_dependency "faraday", ">= 1.0.1", "< 3.0" + spec.add_runtime_dependency "faraday-multipart" + + spec.files = Dir["lib/**/*.rb"] + spec.files = Dir["spec/**/*.rb"] + spec.executables = [] + spec.require_paths = ["lib"] +end