tremendous_ruby 5.6.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/api/tremendous_api.rb +148 -10
  3. data/lib/tremendous/models/balance_transaction.rb +13 -4
  4. data/lib/tremendous/models/balance_transaction_order.rb +256 -0
  5. data/lib/tremendous/models/balance_transaction_order_payment.rb +358 -0
  6. data/lib/tremendous/models/create_report201_response.rb +231 -0
  7. data/lib/tremendous/models/create_report201_response_report.rb +291 -0
  8. data/lib/tremendous/models/create_report_request.rb +295 -0
  9. data/lib/tremendous/models/create_report_request_filters.rb +216 -0
  10. data/lib/tremendous/models/create_report_request_filters_digital_rewards.rb +340 -0
  11. data/lib/tremendous/models/create_report_request_filters_digital_rewards_amount.rb +226 -0
  12. data/lib/tremendous/models/create_report_request_filters_digital_rewards_created_at.rb +226 -0
  13. data/lib/tremendous/models/fraud_review.rb +23 -1
  14. data/lib/tremendous/models/fraud_review_risk.rb +41 -0
  15. data/lib/tremendous/models/get_fraud_review200_response_fraud_review.rb +23 -1
  16. data/lib/tremendous/models/get_order200_response.rb +221 -0
  17. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner.rb +13 -4
  18. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner_order.rb +256 -0
  19. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner_order_payment.rb +358 -0
  20. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +37 -7
  21. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta_failure_details.rb +225 -0
  22. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +64 -7
  23. data/lib/tremendous/models/order_base_payment.rb +64 -7
  24. data/lib/tremendous/models/payment_details.rb +64 -7
  25. data/lib/tremendous/models/payout.rb +16 -4
  26. data/lib/tremendous/models/report.rb +291 -0
  27. data/lib/tremendous/models/resend_reward_request.rb +225 -0
  28. data/lib/tremendous/version.rb +1 -1
  29. data/lib/tremendous.rb +16 -1
  30. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96af2dae4c4e3b8f4fd55ba3cf1b2908106b25f5a42f364f47676ab8a3eb4736
4
- data.tar.gz: c14390cdbef25a5b8c6b9f2cecb6481066de8eac4208ac535ef838690ae1a053
3
+ metadata.gz: 172ed5c1dcd272f89f1277627b38b489c576dffbff029873d0b3e8baf0c851cc
4
+ data.tar.gz: 79460dfe511fe1c9d8b9834b4759a5d92b79cc30b11bc0bcd64382796ff36c13
5
5
  SHA512:
6
- metadata.gz: feee2e80b41fb8f2922417ab31217c1b304c0941969e4f8b64fe19627ae6fa9a238fb672f4c7e0b2908174fc645b79c8595933c8135aa7d0dec8b101c8c34020
7
- data.tar.gz: 54f2f7ec9d4a625997bb3ba8828bc6ad62578ec03961fdc525b5a652ee8011f5c79dcd636b32bfb34d87abfcb227b9067e4d25746a637901eaf6c5cee690dd7b
6
+ metadata.gz: 75f66c3262aa9ec2ba03e5ad3697aee0c0229c1d835c700f1822aba7d5a16da79b642d2149c528efef2370a335048d056470ad88e8627e41f68d4049803d86a3
7
+ data.tar.gz: 850bf2fbe55677c1211be8778497374a8c129d4c80ad454624f51c1b5ff3bf940eb9e7640555117e8699c0be9831c460b2c5e1f1bae60bc8038584defac885f8
@@ -23,7 +23,7 @@ module Tremendous
23
23
  # 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.
24
24
  # @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.
25
25
  # @param [Hash] opts the optional parameters
26
- # @return [CreateOrder201Response]
26
+ # @return [GetOrder200Response]
27
27
  def approve_order(id, opts = {})
28
28
  data, _status_code, _headers = approve_order_with_http_info(id, opts)
29
29
  data
@@ -33,7 +33,7 @@ module Tremendous
33
33
  # 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.
34
34
  # @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.
35
35
  # @param [Hash] opts the optional parameters
36
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
36
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
37
37
  def approve_order_with_http_info(id, opts = {})
38
38
  if @api_client.config.debugging
39
39
  @api_client.config.logger.debug 'Calling API: TremendousApi.approve_order ...'
@@ -65,7 +65,7 @@ module Tremendous
65
65
  post_body = opts[:debug_body]
66
66
 
67
67
  # return_type
68
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
68
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
69
69
 
70
70
  # auth_names
71
71
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -545,6 +545,74 @@ module Tremendous
545
545
  return data, status_code, headers
546
546
  end
547
547
 
548
+ # Create report
549
+ # Creating a report allows your organization to programmatically retrieve information that's available in our dashboard UI. This request creates a new report object with a unique ID, and kicks off an async report generation. To retrieve a completed report, either poll `/api/v2/reports/{id}` or listen for REPORTS webhook event. ## 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\">report_type</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Type of report for retrieval. <table> <thead> <tr> <th>Report type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>digital_rewards</code></td> <td>Report for Tremendous digital reward history</td> </tr> </tbody> </table></p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">format</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Format the report will be generated in. <table> <thead> <tr> <th>Format</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>csv</code></td> <td>CSV format for report</td> </tr> </tbody> </table></p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">filters</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Filters to apply to the report. Corresponds to the filters provided in the dashboard</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\">digital_rewards</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Filters object for a <code>report_type: digital_rewards</code> report</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\">amount</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Amount of the rewards returned in the report</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\">gte</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Minimum amount of the rewards that should be returned in the report</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">lte</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Maximum amount of the rewards that should be returned in the report</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><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 Tremendous campaign that this report should be limited to</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">created_at</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Creation dates of rewards returned in the report</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\">gte</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Minimum date the reward was created</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">lte</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Maximum date the reward was created</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivered_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Delivery date for gifts that should be returned in the report</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery_method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Delivery method for rewards returned in the report</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">order_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the Tremendous order that this report should be limited to</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">order_status</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Order status for rewards returned in the report</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">status</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>Status for rewards returned in the report</p> </td></tr> </tbody> </table> </tr> </tbody> </table> </tr> </tbody> </table> </div> ## Rate limits Some reports may take a long time to generate and we limit the number of reports that can be simulataneously generated by an organization at a given time. If you exceed the rate limit, you'll receive a `429` response.
550
+ # @param create_report_request [CreateReportRequest] Report to create
551
+ # @param [Hash] opts the optional parameters
552
+ # @return [CreateReport201Response]
553
+ def create_report(create_report_request, opts = {})
554
+ data, _status_code, _headers = create_report_with_http_info(create_report_request, opts)
555
+ data
556
+ end
557
+
558
+ # Create report
559
+ # Creating a report allows your organization to programmatically retrieve information that&#39;s available in our dashboard UI. This request creates a new report object with a unique ID, and kicks off an async report generation. To retrieve a completed report, either poll &#x60;/api/v2/reports/{id}&#x60; or listen for REPORTS webhook event. ## Request body &lt;div class&#x3D;\&quot;object-schema-request-schema\&quot;&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Property&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class&#x3D;\&quot;object-schema-table-body\&quot;&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;report_type&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Type of report for retrieval. &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Report type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;digital_rewards&lt;/code&gt;&lt;/td&gt; &lt;td&gt;Report for Tremendous digital reward history&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;format&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Format the report will be generated in. &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Format&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;code&gt;csv&lt;/code&gt;&lt;/td&gt; &lt;td&gt;CSV format for report&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt;&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;filters&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;object&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Filters to apply to the report. Corresponds to the filters provided in the dashboard&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan&#x3D;\&quot;3\&quot;&gt; &lt;details&gt; &lt;summary&gt;Show object properties&lt;/summary&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Property&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class&#x3D;\&quot;object-schema-table-body\&quot;&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;digital_rewards&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;object&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Filters object for a &lt;code&gt;report_type: digital_rewards&lt;/code&gt; report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan&#x3D;\&quot;3\&quot;&gt; &lt;details&gt; &lt;summary&gt;Show object properties&lt;/summary&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Property&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class&#x3D;\&quot;object-schema-table-body\&quot;&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;amount&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;object&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Amount of the rewards returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan&#x3D;\&quot;3\&quot;&gt; &lt;details&gt; &lt;summary&gt;Show object properties&lt;/summary&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Property&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class&#x3D;\&quot;object-schema-table-body\&quot;&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;gte&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;number&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Minimum amount of the rewards that should be returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;lte&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;number&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Maximum amount of the rewards that should be returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;campaign_id&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;ID of the Tremendous campaign that this report should be limited to&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;created_at&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;object&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Creation dates of rewards returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan&#x3D;\&quot;3\&quot;&gt; &lt;details&gt; &lt;summary&gt;Show object properties&lt;/summary&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Property&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody class&#x3D;\&quot;object-schema-table-body\&quot;&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;gte&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;date&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Minimum date the reward was created&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;lte&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;date&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Maximum date the reward was created&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;delivered_at&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;date&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Delivery date for gifts that should be returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;delivery_method&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Delivery method for rewards returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;order_id&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;ID of the Tremendous order that this report should be limited to&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;order_status&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Order status for rewards returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr class&#x3D;\&quot;\&quot;&gt;&lt;td&gt;&lt;div class&#x3D;\&quot;property-name\&quot;&gt; &lt;code class&#x3D;\&quot;property-name\&quot;&gt;status&lt;/code&gt; &lt;/div&gt; &lt;/td&gt;&lt;td&gt;&lt;span class&#x3D;\&quot;property-type\&quot;&gt;array&lt;/span&gt; &lt;span class&#x3D;\&quot;property-format\&quot;&gt;string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;Status for rewards returned in the report&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; ## Rate limits Some reports may take a long time to generate and we limit the number of reports that can be simulataneously generated by an organization at a given time. If you exceed the rate limit, you&#39;ll receive a &#x60;429&#x60; response.
560
+ # @param create_report_request [CreateReportRequest] Report to create
561
+ # @param [Hash] opts the optional parameters
562
+ # @return [Array<(CreateReport201Response, Integer, Hash)>] CreateReport201Response data, response status code and response headers
563
+ def create_report_with_http_info(create_report_request, opts = {})
564
+ if @api_client.config.debugging
565
+ @api_client.config.logger.debug 'Calling API: TremendousApi.create_report ...'
566
+ end
567
+ # verify the required parameter 'create_report_request' is set
568
+ if @api_client.config.client_side_validation && create_report_request.nil?
569
+ fail ArgumentError, "Missing the required parameter 'create_report_request' when calling TremendousApi.create_report"
570
+ end
571
+ # resource path
572
+ local_var_path = '/reports'
573
+
574
+ # query parameters
575
+ query_params = opts[:query_params] || {}
576
+
577
+ # header parameters
578
+ header_params = opts[:header_params] || {}
579
+ # HTTP header 'Accept' (if needed)
580
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
581
+ # HTTP header 'Content-Type'
582
+ content_type = @api_client.select_header_content_type(['application/json'])
583
+ if !content_type.nil?
584
+ header_params['Content-Type'] = content_type
585
+ end
586
+
587
+ # form parameters
588
+ form_params = opts[:form_params] || {}
589
+
590
+ # http body (model)
591
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_report_request)
592
+
593
+ # return_type
594
+ return_type = opts[:debug_return_type] || 'CreateReport201Response'
595
+
596
+ # auth_names
597
+ auth_names = opts[:debug_auth_names] || ['BearerApiKey']
598
+
599
+ new_options = opts.merge(
600
+ :operation => :"TremendousApi.create_report",
601
+ :header_params => header_params,
602
+ :query_params => query_params,
603
+ :form_params => form_params,
604
+ :body => post_body,
605
+ :auth_names => auth_names,
606
+ :return_type => return_type
607
+ )
608
+
609
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
610
+ if @api_client.config.debugging
611
+ @api_client.config.logger.debug "API called: TremendousApi#create_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
612
+ end
613
+ return data, status_code, headers
614
+ end
615
+
548
616
  # Create webhook
549
617
  # 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>
550
618
  # @param create_webhook_request [CreateWebhookRequest] Webhook details
@@ -1481,7 +1549,7 @@ module Tremendous
1481
1549
  # Retrieve the order, identified by the given `id` in the URL
1482
1550
  # @param id [String] ID of the order that should be retrieved. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
1483
1551
  # @param [Hash] opts the optional parameters
1484
- # @return [CreateOrder201Response]
1552
+ # @return [GetOrder200Response]
1485
1553
  def get_order(id, opts = {})
1486
1554
  data, _status_code, _headers = get_order_with_http_info(id, opts)
1487
1555
  data
@@ -1491,7 +1559,7 @@ module Tremendous
1491
1559
  # Retrieve the order, identified by the given &#x60;id&#x60; in the URL
1492
1560
  # @param id [String] ID of the order that should be retrieved. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
1493
1561
  # @param [Hash] opts the optional parameters
1494
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
1562
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
1495
1563
  def get_order_with_http_info(id, opts = {})
1496
1564
  if @api_client.config.debugging
1497
1565
  @api_client.config.logger.debug 'Calling API: TremendousApi.get_order ...'
@@ -1518,7 +1586,7 @@ module Tremendous
1518
1586
  post_body = opts[:debug_body]
1519
1587
 
1520
1588
  # return_type
1521
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
1589
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
1522
1590
 
1523
1591
  # auth_names
1524
1592
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -1674,6 +1742,69 @@ module Tremendous
1674
1742
  return data, status_code, headers
1675
1743
  end
1676
1744
 
1745
+ # Retrieve report
1746
+ # Retrieve the report, identified by the given `id` in the URL Using the ID that was returned by `POST /api/v2/reports`, retrieves a download link for the report, identified by the given ID in the URL. Returns the report’s current status and, if available, the URL for download. The URL is valid for 7 days.
1747
+ # @param id [String] ID of the report that should be retrieved. ID is returned from &#x60;POST&#x60; to /api/v2/reports
1748
+ # @param [Hash] opts the optional parameters
1749
+ # @return [CreateReport201Response]
1750
+ def get_report(id, opts = {})
1751
+ data, _status_code, _headers = get_report_with_http_info(id, opts)
1752
+ data
1753
+ end
1754
+
1755
+ # Retrieve report
1756
+ # Retrieve the report, identified by the given &#x60;id&#x60; in the URL Using the ID that was returned by &#x60;POST /api/v2/reports&#x60;, retrieves a download link for the report, identified by the given ID in the URL. Returns the report’s current status and, if available, the URL for download. The URL is valid for 7 days.
1757
+ # @param id [String] ID of the report that should be retrieved. ID is returned from &#x60;POST&#x60; to /api/v2/reports
1758
+ # @param [Hash] opts the optional parameters
1759
+ # @return [Array<(CreateReport201Response, Integer, Hash)>] CreateReport201Response data, response status code and response headers
1760
+ def get_report_with_http_info(id, opts = {})
1761
+ if @api_client.config.debugging
1762
+ @api_client.config.logger.debug 'Calling API: TremendousApi.get_report ...'
1763
+ end
1764
+ # verify the required parameter 'id' is set
1765
+ if @api_client.config.client_side_validation && id.nil?
1766
+ fail ArgumentError, "Missing the required parameter 'id' when calling TremendousApi.get_report"
1767
+ end
1768
+ # resource path
1769
+ local_var_path = '/reports/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
1770
+
1771
+ # query parameters
1772
+ query_params = opts[:query_params] || {}
1773
+
1774
+ # header parameters
1775
+ header_params = opts[:header_params] || {}
1776
+ # HTTP header 'Accept' (if needed)
1777
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1778
+
1779
+ # form parameters
1780
+ form_params = opts[:form_params] || {}
1781
+
1782
+ # http body (model)
1783
+ post_body = opts[:debug_body]
1784
+
1785
+ # return_type
1786
+ return_type = opts[:debug_return_type] || 'CreateReport201Response'
1787
+
1788
+ # auth_names
1789
+ auth_names = opts[:debug_auth_names] || ['BearerApiKey']
1790
+
1791
+ new_options = opts.merge(
1792
+ :operation => :"TremendousApi.get_report",
1793
+ :header_params => header_params,
1794
+ :query_params => query_params,
1795
+ :form_params => form_params,
1796
+ :body => post_body,
1797
+ :auth_names => auth_names,
1798
+ :return_type => return_type
1799
+ )
1800
+
1801
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1802
+ if @api_client.config.debugging
1803
+ @api_client.config.logger.debug "API called: TremendousApi#get_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1804
+ end
1805
+ return data, status_code, headers
1806
+ end
1807
+
1677
1808
  # Retrieve single reward
1678
1809
  # Retrieve the reward, identified by the given `id` in the URL
1679
1810
  # @param id [String] ID of the reward that should be retrieved
@@ -2822,7 +2953,7 @@ module Tremendous
2822
2953
  # 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.
2823
2954
  # @param id [String] ID of the order that should be rejected. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
2824
2955
  # @param [Hash] opts the optional parameters
2825
- # @return [CreateOrder201Response]
2956
+ # @return [GetOrder200Response]
2826
2957
  def reject_order(id, opts = {})
2827
2958
  data, _status_code, _headers = reject_order_with_http_info(id, opts)
2828
2959
  data
@@ -2832,7 +2963,7 @@ module Tremendous
2832
2963
  # Rejects an order that is pending review, identified by the given &#x60;id&#x60; 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 &#39;Allow approvals via API&#39; via the organization&#39;&#39;s &#39;Order Approvals&#39; settings from the Tremendous dashboard.
2833
2964
  # @param id [String] ID of the order that should be rejected. In case the order has an &#x60;external_id&#x60; reference supplied by the customer on creation, it&#39;s possible to use it instead.
2834
2965
  # @param [Hash] opts the optional parameters
2835
- # @return [Array<(CreateOrder201Response, Integer, Hash)>] CreateOrder201Response data, response status code and response headers
2966
+ # @return [Array<(GetOrder200Response, Integer, Hash)>] GetOrder200Response data, response status code and response headers
2836
2967
  def reject_order_with_http_info(id, opts = {})
2837
2968
  if @api_client.config.debugging
2838
2969
  @api_client.config.logger.debug 'Calling API: TremendousApi.reject_order ...'
@@ -2864,7 +2995,7 @@ module Tremendous
2864
2995
  post_body = opts[:debug_body]
2865
2996
 
2866
2997
  # return_type
2867
- return_type = opts[:debug_return_type] || 'CreateOrder201Response'
2998
+ return_type = opts[:debug_return_type] || 'GetOrder200Response'
2868
2999
 
2869
3000
  # auth_names
2870
3001
  auth_names = opts[:debug_auth_names] || ['BearerApiKey']
@@ -2953,6 +3084,7 @@ module Tremendous
2953
3084
  # Resends a reward, identified by the given `id` in the URL, to its recipient.
2954
3085
  # @param id [String] ID of the reward that should be resent
2955
3086
  # @param [Hash] opts the optional parameters
3087
+ # @option opts [ResendRewardRequest] :resend_reward_request _Only_ for rewards with a previous delivery failure: You can update the email or phone number used for the resend. You can only provide one of &#x60;updated_email&#x60; or &#x60;updated_phone&#x60;, not both.
2956
3088
  # @return [Object]
2957
3089
  def resend_reward(id, opts = {})
2958
3090
  data, _status_code, _headers = resend_reward_with_http_info(id, opts)
@@ -2963,6 +3095,7 @@ module Tremendous
2963
3095
  # Resends a reward, identified by the given &#x60;id&#x60; in the URL, to its recipient.
2964
3096
  # @param id [String] ID of the reward that should be resent
2965
3097
  # @param [Hash] opts the optional parameters
3098
+ # @option opts [ResendRewardRequest] :resend_reward_request _Only_ for rewards with a previous delivery failure: You can update the email or phone number used for the resend. You can only provide one of &#x60;updated_email&#x60; or &#x60;updated_phone&#x60;, not both.
2966
3099
  # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
2967
3100
  def resend_reward_with_http_info(id, opts = {})
2968
3101
  if @api_client.config.debugging
@@ -2987,12 +3120,17 @@ module Tremendous
2987
3120
  header_params = opts[:header_params] || {}
2988
3121
  # HTTP header 'Accept' (if needed)
2989
3122
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3123
+ # HTTP header 'Content-Type'
3124
+ content_type = @api_client.select_header_content_type(['application/json'])
3125
+ if !content_type.nil?
3126
+ header_params['Content-Type'] = content_type
3127
+ end
2990
3128
 
2991
3129
  # form parameters
2992
3130
  form_params = opts[:form_params] || {}
2993
3131
 
2994
3132
  # http body (model)
2995
- post_body = opts[:debug_body]
3133
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'resend_reward_request'])
2996
3134
 
2997
3135
  # return_type
2998
3136
  return_type = opts[:debug_return_type] || 'Object'
@@ -31,6 +31,8 @@ module Tremendous
31
31
  # A brief description of the transaction
32
32
  attr_accessor :description
33
33
 
34
+ attr_accessor :order
35
+
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
35
37
  def self.attribute_map
36
38
  {
@@ -38,7 +40,8 @@ module Tremendous
38
40
  :'amount' => :'amount',
39
41
  :'balance' => :'balance',
40
42
  :'action' => :'action',
41
- :'description' => :'description'
43
+ :'description' => :'description',
44
+ :'order' => :'order'
42
45
  }
43
46
  end
44
47
 
@@ -54,7 +57,8 @@ module Tremendous
54
57
  :'amount' => :'Float',
55
58
  :'balance' => :'Float',
56
59
  :'action' => :'String',
57
- :'description' => :'String'
60
+ :'description' => :'String',
61
+ :'order' => :'BalanceTransactionOrder'
58
62
  }
59
63
  end
60
64
 
@@ -108,6 +112,10 @@ module Tremendous
108
112
  else
109
113
  self.description = nil
110
114
  end
115
+
116
+ if attributes.key?(:'order')
117
+ self.order = attributes[:'order']
118
+ end
111
119
  end
112
120
 
113
121
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -159,7 +167,8 @@ module Tremendous
159
167
  amount == o.amount &&
160
168
  balance == o.balance &&
161
169
  action == o.action &&
162
- description == o.description
170
+ description == o.description &&
171
+ order == o.order
163
172
  end
164
173
 
165
174
  # @see the `==` method
@@ -171,7 +180,7 @@ module Tremendous
171
180
  # Calculates hash code according to all attributes.
172
181
  # @return [Integer] Hash code
173
182
  def hash
174
- [created_at, amount, balance, action, description].hash
183
+ [created_at, amount, balance, action, description, order].hash
175
184
  end
176
185
 
177
186
  # Builds the object from hash
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #API Endpoints
3
+
4
+ #Deliver monetary rewards and incentives to employees, customers, survey participants, and more through the Tremendous API. For organizational tasks, like managing your organization and it's members within Tremendous, please see the Tremendous Organizational API.
5
+
6
+ The version of the OpenAPI document: 2
7
+ Contact: developers@tremendous.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.8.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ # Order details
18
+ class BalanceTransactionOrder
19
+ attr_accessor :id
20
+
21
+ # 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.
22
+ attr_accessor :external_id
23
+
24
+ attr_accessor :payment
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'id' => :'id',
30
+ :'external_id' => :'external_id',
31
+ :'payment' => :'payment'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'id' => :'String',
44
+ :'external_id' => :'String',
45
+ :'payment' => :'BalanceTransactionOrderPayment'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ :'external_id',
53
+ ])
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ if (!attributes.is_a?(Hash))
60
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::BalanceTransactionOrder` initialize method"
61
+ end
62
+
63
+ # check to see if the attribute exists and convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}) { |(k, v), h|
65
+ if (!self.class.attribute_map.key?(k.to_sym))
66
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::BalanceTransactionOrder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
+ end
68
+ h[k.to_sym] = v
69
+ }
70
+
71
+ if attributes.key?(:'id')
72
+ self.id = attributes[:'id']
73
+ end
74
+
75
+ if attributes.key?(:'external_id')
76
+ self.external_id = attributes[:'external_id']
77
+ end
78
+
79
+ if attributes.key?(:'payment')
80
+ self.payment = attributes[:'payment']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
88
+ invalid_properties = Array.new
89
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
90
+ if !@id.nil? && @id !~ pattern
91
+ invalid_properties.push("invalid value for \"id\", must conform to the pattern #{pattern}.")
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ warn '[DEPRECATED] the `valid?` method is obsolete'
101
+ return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method with validation
106
+ # @param [Object] id Value to be assigned
107
+ def id=(id)
108
+ if id.nil?
109
+ fail ArgumentError, 'id cannot be nil'
110
+ end
111
+
112
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
113
+ if id !~ pattern
114
+ fail ArgumentError, "invalid value for \"id\", must conform to the pattern #{pattern}."
115
+ end
116
+
117
+ @id = id
118
+ end
119
+
120
+ # Checks equality by comparing each attribute.
121
+ # @param [Object] Object to be compared
122
+ def ==(o)
123
+ return true if self.equal?(o)
124
+ self.class == o.class &&
125
+ id == o.id &&
126
+ external_id == o.external_id &&
127
+ payment == o.payment
128
+ end
129
+
130
+ # @see the `==` method
131
+ # @param [Object] Object to be compared
132
+ def eql?(o)
133
+ self == o
134
+ end
135
+
136
+ # Calculates hash code according to all attributes.
137
+ # @return [Integer] Hash code
138
+ def hash
139
+ [id, external_id, payment].hash
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def self.build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ transformed_hash = {}
149
+ openapi_types.each_pair do |key, type|
150
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
151
+ transformed_hash["#{key}"] = nil
152
+ elsif type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[attribute_map[key]].is_a?(Array)
156
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
157
+ end
158
+ elsif !attributes[attribute_map[key]].nil?
159
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
160
+ end
161
+ end
162
+ new(transformed_hash)
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def self._deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = Tremendous.const_get(type)
204
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end