tremendous_ruby 5.13.0 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6444bf51beb3a23f2b5372ef7dbd452de68808caf545876e914e9ad47d24155
4
- data.tar.gz: d7015e2adfc340231076d4d69a775d520a9f6aa6bdf3b027b013fef700181aae
3
+ metadata.gz: 0c5dd6664a6eefcc985f6a14c06479a546be0159faa9ec89c9de1453a464ee5b
4
+ data.tar.gz: 64512c466b295d0cd90efac6774506d6dcc94f32a2f6a587d5fe4f25596e001c
5
5
  SHA512:
6
- metadata.gz: 69a3c98e1376554ff58f7b56156361599aeb4a47441aec7b7dea65d19969ff29fb63a79c6cb1e13b0b81becaf10ef9903ca258e06b8fcabd0a1188d793be9656
7
- data.tar.gz: 2e385b12754d2922e30355a47600f6d58412bbb6deebbdfac3d29023c798ef2bf8be5a80d4ffe323f1eb7d5b766de8858dac45481516f64e2147cd434afb7d8e
6
+ metadata.gz: b971bd05346daf9744ad93b796b3101d0e62df5b8f3b6023da23f0443f58a6e809c7318324f1f71b0d7e40551d5d1b4666c6322066e1c0c6a4db147be1a786e8
7
+ data.tar.gz: 4f2489025b53b3b4b5eb28830b1913e3b7faf67dc46463757e624423b827f81c6e6da68463d8b1cb98da720eb139dabc225e74a17c2ec3e7c7a6d98521066a6c
@@ -552,7 +552,7 @@ module Tremendous
552
552
  end
553
553
 
554
554
  # Create invoice
555
- # 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>
555
+ # 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</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the invoice</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>
556
556
  # @param create_invoice_request [CreateInvoiceRequest] Invoice details
557
557
  # @param [Hash] opts the optional parameters
558
558
  # @return [CreateInvoice200Response]
@@ -562,7 +562,7 @@ module Tremendous
562
562
  end
563
563
 
564
564
  # Create invoice
565
- # Creating an invoice is the way for your organization to fund your account&#39;s balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account&#39;s balance ## 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;po_number&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;Reference to the purchase order number within your organization&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;amount&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;Amount of the invoice in USD&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;memo&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;A note to be included in the invoice. This is for your internal use and will not be visible to the recipient.&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt;
565
+ # Creating an invoice is the way for your organization to fund your account&#39;s balance. 1. Create an invoice 2. Pay the invoice 3. Funds get added to your account&#39;s balance ## 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;po_number&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;Reference to the purchase order number within your organization&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;amount&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;Amount of the invoice&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;currency&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;Currency of the invoice&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;memo&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;A note to be included in the invoice. This is for your internal use and will not be visible to the recipient.&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt;
566
566
  # @param create_invoice_request [CreateInvoiceRequest] Invoice details
567
567
  # @param [Hash] opts the optional parameters
568
568
  # @return [Array<(CreateInvoice200Response, Integer, Hash)>] CreateInvoice200Response data, response status code and response headers
@@ -891,6 +891,68 @@ module Tremendous
891
891
  return data, status_code, headers
892
892
  end
893
893
 
894
+ # Create a topup
895
+ # @param [Hash] opts the optional parameters
896
+ # @option opts [CreateTopupRequest] :create_topup_request Parameters required to create a new topup. The &#x60;idempotency_key&#x60; should be unique for each request.
897
+ # @return [CreateTopup200Response]
898
+ def create_topup(opts = {})
899
+ data, _status_code, _headers = create_topup_with_http_info(opts)
900
+ data
901
+ end
902
+
903
+ # Create a topup
904
+ # @param [Hash] opts the optional parameters
905
+ # @option opts [CreateTopupRequest] :create_topup_request Parameters required to create a new topup. The &#x60;idempotency_key&#x60; should be unique for each request.
906
+ # @return [Array<(CreateTopup200Response, Integer, Hash)>] CreateTopup200Response data, response status code and response headers
907
+ def create_topup_with_http_info(opts = {})
908
+ if @api_client.config.debugging
909
+ @api_client.config.logger.debug 'Calling API: TremendousApi.create_topup ...'
910
+ end
911
+ # resource path
912
+ local_var_path = '/topups'
913
+
914
+ # query parameters
915
+ query_params = opts[:query_params] || {}
916
+
917
+ # header parameters
918
+ header_params = opts[:header_params] || {}
919
+ # HTTP header 'Accept' (if needed)
920
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
921
+ # HTTP header 'Content-Type'
922
+ content_type = @api_client.select_header_content_type(['application/json'])
923
+ if !content_type.nil?
924
+ header_params['Content-Type'] = content_type
925
+ end
926
+
927
+ # form parameters
928
+ form_params = opts[:form_params] || {}
929
+
930
+ # http body (model)
931
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_topup_request'])
932
+
933
+ # return_type
934
+ return_type = opts[:debug_return_type] || 'CreateTopup200Response'
935
+
936
+ # auth_names
937
+ auth_names = opts[:debug_auth_names] || ['BearerApiKey']
938
+
939
+ new_options = opts.merge(
940
+ :operation => :"TremendousApi.create_topup",
941
+ :header_params => header_params,
942
+ :query_params => query_params,
943
+ :form_params => form_params,
944
+ :body => post_body,
945
+ :auth_names => auth_names,
946
+ :return_type => return_type
947
+ )
948
+
949
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
950
+ if @api_client.config.debugging
951
+ @api_client.config.logger.debug "API called: TremendousApi#create_topup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
952
+ end
953
+ return data, status_code, headers
954
+ end
955
+
894
956
  # Create webhook
895
957
  # 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>
896
958
  # @param create_webhook_request [CreateWebhookRequest] Webhook details
@@ -1685,8 +1747,8 @@ module Tremendous
1685
1747
  end
1686
1748
 
1687
1749
  # Retrieve funding source
1688
- # Retrieve a funding source, identified by the given `id` in the URL
1689
- # @param id [String] ID of the funding source that should be retrieved
1750
+ # Retrieve a funding source, identified by the given `id` in the URL. You can also use the special keyword `BALANCE` (case-insensitive) to retrieve the organization's balance funding source.
1751
+ # @param id [String] ID of the funding source that should be retrieved. Can also use \&quot;BALANCE\&quot; (case-insensitive) to retrieve the organization&#39;s balance funding source.
1690
1752
  # @param [Hash] opts the optional parameters
1691
1753
  # @return [GetFundingSource200Response]
1692
1754
  def get_funding_source(id, opts = {})
@@ -1695,8 +1757,8 @@ module Tremendous
1695
1757
  end
1696
1758
 
1697
1759
  # Retrieve funding source
1698
- # Retrieve a funding source, identified by the given &#x60;id&#x60; in the URL
1699
- # @param id [String] ID of the funding source that should be retrieved
1760
+ # Retrieve a funding source, identified by the given &#x60;id&#x60; in the URL. You can also use the special keyword &#x60;BALANCE&#x60; (case-insensitive) to retrieve the organization&#39;s balance funding source.
1761
+ # @param id [String] ID of the funding source that should be retrieved. Can also use \&quot;BALANCE\&quot; (case-insensitive) to retrieve the organization&#39;s balance funding source.
1700
1762
  # @param [Hash] opts the optional parameters
1701
1763
  # @return [Array<(GetFundingSource200Response, Integer, Hash)>] GetFundingSource200Response data, response status code and response headers
1702
1764
  def get_funding_source_with_http_info(id, opts = {})
@@ -1707,7 +1769,7 @@ module Tremendous
1707
1769
  if @api_client.config.client_side_validation && id.nil?
1708
1770
  fail ArgumentError, "Missing the required parameter 'id' when calling TremendousApi.get_funding_source"
1709
1771
  end
1710
- pattern = Regexp.new(/[A-Z0-9]{4,20}/)
1772
+ pattern = Regexp.new(/^([A-Z0-9]{4,20}|[Bb][Aa][Ll][Aa][Nn][Cc][Ee])$/)
1711
1773
  if @api_client.config.client_side_validation && id !~ pattern
1712
1774
  fail ArgumentError, "invalid value for 'id' when calling TremendousApi.get_funding_source, must conform to the pattern #{pattern}."
1713
1775
  end
@@ -2209,6 +2271,74 @@ module Tremendous
2209
2271
  return data, status_code, headers
2210
2272
  end
2211
2273
 
2274
+ # Retrieve single topup
2275
+ # Retrieve a topup, identified by the given `id` in the URL.
2276
+ # @param id [String] ID of the topup request that should be retrieved
2277
+ # @param [Hash] opts the optional parameters
2278
+ # @return [CreateTopup200Response]
2279
+ def get_topup(id, opts = {})
2280
+ data, _status_code, _headers = get_topup_with_http_info(id, opts)
2281
+ data
2282
+ end
2283
+
2284
+ # Retrieve single topup
2285
+ # Retrieve a topup, identified by the given &#x60;id&#x60; in the URL.
2286
+ # @param id [String] ID of the topup request that should be retrieved
2287
+ # @param [Hash] opts the optional parameters
2288
+ # @return [Array<(CreateTopup200Response, Integer, Hash)>] CreateTopup200Response data, response status code and response headers
2289
+ def get_topup_with_http_info(id, opts = {})
2290
+ if @api_client.config.debugging
2291
+ @api_client.config.logger.debug 'Calling API: TremendousApi.get_topup ...'
2292
+ end
2293
+ # verify the required parameter 'id' is set
2294
+ if @api_client.config.client_side_validation && id.nil?
2295
+ fail ArgumentError, "Missing the required parameter 'id' when calling TremendousApi.get_topup"
2296
+ end
2297
+ pattern = Regexp.new(/[A-Z0-9]{4,20}/)
2298
+ if @api_client.config.client_side_validation && id !~ pattern
2299
+ fail ArgumentError, "invalid value for 'id' when calling TremendousApi.get_topup, must conform to the pattern #{pattern}."
2300
+ end
2301
+
2302
+ # resource path
2303
+ local_var_path = '/topups/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
2304
+
2305
+ # query parameters
2306
+ query_params = opts[:query_params] || {}
2307
+
2308
+ # header parameters
2309
+ header_params = opts[:header_params] || {}
2310
+ # HTTP header 'Accept' (if needed)
2311
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2312
+
2313
+ # form parameters
2314
+ form_params = opts[:form_params] || {}
2315
+
2316
+ # http body (model)
2317
+ post_body = opts[:debug_body]
2318
+
2319
+ # return_type
2320
+ return_type = opts[:debug_return_type] || 'CreateTopup200Response'
2321
+
2322
+ # auth_names
2323
+ auth_names = opts[:debug_auth_names] || ['BearerApiKey']
2324
+
2325
+ new_options = opts.merge(
2326
+ :operation => :"TremendousApi.get_topup",
2327
+ :header_params => header_params,
2328
+ :query_params => query_params,
2329
+ :form_params => form_params,
2330
+ :body => post_body,
2331
+ :auth_names => auth_names,
2332
+ :return_type => return_type
2333
+ )
2334
+
2335
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2336
+ if @api_client.config.debugging
2337
+ @api_client.config.logger.debug "API called: TremendousApi#get_topup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2338
+ end
2339
+ return data, status_code, headers
2340
+ end
2341
+
2212
2342
  # Retrieve webhook
2213
2343
  # > 📘 Learn more about Webhooks > > Our guide explains everything you need to know about the Tremendous webhooks: > [Read it here](/docs/webhooks-1)
2214
2344
  # @param id [String] ID of the webhook to retrieve
@@ -3299,6 +3429,66 @@ module Tremendous
3299
3429
  return data, status_code, headers
3300
3430
  end
3301
3431
 
3432
+ # List topups
3433
+ # Retrieve a list of all topup requests.
3434
+ # @param [Hash] opts the optional parameters
3435
+ # @option opts [Integer] :offset Offsets the returned list by the given number of topups. The returned topups are ordered and offset by their creation date (DESC).
3436
+ # @return [ListTopups200Response]
3437
+ def list_topups(opts = {})
3438
+ data, _status_code, _headers = list_topups_with_http_info(opts)
3439
+ data
3440
+ end
3441
+
3442
+ # List topups
3443
+ # Retrieve a list of all topup requests.
3444
+ # @param [Hash] opts the optional parameters
3445
+ # @option opts [Integer] :offset Offsets the returned list by the given number of topups. The returned topups are ordered and offset by their creation date (DESC).
3446
+ # @return [Array<(ListTopups200Response, Integer, Hash)>] ListTopups200Response data, response status code and response headers
3447
+ def list_topups_with_http_info(opts = {})
3448
+ if @api_client.config.debugging
3449
+ @api_client.config.logger.debug 'Calling API: TremendousApi.list_topups ...'
3450
+ end
3451
+ # resource path
3452
+ local_var_path = '/topups'
3453
+
3454
+ # query parameters
3455
+ query_params = opts[:query_params] || {}
3456
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
3457
+
3458
+ # header parameters
3459
+ header_params = opts[:header_params] || {}
3460
+ # HTTP header 'Accept' (if needed)
3461
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3462
+
3463
+ # form parameters
3464
+ form_params = opts[:form_params] || {}
3465
+
3466
+ # http body (model)
3467
+ post_body = opts[:debug_body]
3468
+
3469
+ # return_type
3470
+ return_type = opts[:debug_return_type] || 'ListTopups200Response'
3471
+
3472
+ # auth_names
3473
+ auth_names = opts[:debug_auth_names] || ['BearerApiKey']
3474
+
3475
+ new_options = opts.merge(
3476
+ :operation => :"TremendousApi.list_topups",
3477
+ :header_params => header_params,
3478
+ :query_params => query_params,
3479
+ :form_params => form_params,
3480
+ :body => post_body,
3481
+ :auth_names => auth_names,
3482
+ :return_type => return_type
3483
+ )
3484
+
3485
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3486
+ if @api_client.config.debugging
3487
+ @api_client.config.logger.debug "API called: TremendousApi#list_topups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3488
+ end
3489
+ return data, status_code, headers
3490
+ end
3491
+
3302
3492
  # List events
3303
3493
  # 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)
3304
3494
  # @param id [String] ID of the webhook to list the events for
@@ -18,17 +18,43 @@ module Tremendous
18
18
  # Reference to the purchase order number within your organization
19
19
  attr_accessor :po_number
20
20
 
21
- # Amount of the invoice in USD
21
+ # Amount of the invoice
22
22
  attr_accessor :amount
23
23
 
24
+ # Currency of the invoice
25
+ attr_accessor :currency
26
+
24
27
  # A note to be included in the invoice. This is for your internal use and will not be visible to the recipient.
25
28
  attr_accessor :memo
26
29
 
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
27
52
  # Attribute mapping from ruby-style variable name to JSON key.
28
53
  def self.attribute_map
29
54
  {
30
55
  :'po_number' => :'po_number',
31
56
  :'amount' => :'amount',
57
+ :'currency' => :'currency',
32
58
  :'memo' => :'memo'
33
59
  }
34
60
  end
@@ -48,6 +74,7 @@ module Tremendous
48
74
  {
49
75
  :'po_number' => :'String',
50
76
  :'amount' => :'Float',
77
+ :'currency' => :'String',
51
78
  :'memo' => :'String'
52
79
  }
53
80
  end
@@ -86,6 +113,12 @@ module Tremendous
86
113
  self.amount = nil
87
114
  end
88
115
 
116
+ if attributes.key?(:'currency')
117
+ self.currency = attributes[:'currency']
118
+ else
119
+ self.currency = 'USD'
120
+ end
121
+
89
122
  if attributes.key?(:'memo')
90
123
  self.memo = attributes[:'memo']
91
124
  end
@@ -108,6 +141,8 @@ module Tremendous
108
141
  def valid?
109
142
  warn '[DEPRECATED] the `valid?` method is obsolete'
110
143
  return false if @amount.nil?
144
+ currency_validator = EnumAttributeValidator.new('String', ["USD", "EUR", "GBP"])
145
+ return false unless currency_validator.valid?(@currency)
111
146
  true
112
147
  end
113
148
 
@@ -121,6 +156,16 @@ module Tremendous
121
156
  @amount = amount
122
157
  end
123
158
 
159
+ # Custom attribute writer method checking allowed values (enum).
160
+ # @param [Object] currency Object to be assigned
161
+ def currency=(currency)
162
+ validator = EnumAttributeValidator.new('String', ["USD", "EUR", "GBP"])
163
+ unless validator.valid?(currency)
164
+ fail ArgumentError, "invalid value for \"currency\", must be one of #{validator.allowable_values}."
165
+ end
166
+ @currency = currency
167
+ end
168
+
124
169
  # Checks equality by comparing each attribute.
125
170
  # @param [Object] Object to be compared
126
171
  def ==(o)
@@ -128,6 +173,7 @@ module Tremendous
128
173
  self.class == o.class &&
129
174
  po_number == o.po_number &&
130
175
  amount == o.amount &&
176
+ currency == o.currency &&
131
177
  memo == o.memo
132
178
  end
133
179
 
@@ -140,7 +186,7 @@ module Tremendous
140
186
  # Calculates hash code according to all attributes.
141
187
  # @return [Integer] Hash code
142
188
  def hash
143
- [po_number, amount, memo].hash
189
+ [po_number, amount, currency, memo].hash
144
190
  end
145
191
 
146
192
  # Builds the object from hash
@@ -0,0 +1,220 @@
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 its 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.12.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Tremendous
17
+ class CreateTopup200Response
18
+ attr_accessor :topup
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'topup' => :'topup'
24
+ }
25
+ end
26
+
27
+ # Returns attribute mapping this model knows about
28
+ def self.acceptable_attribute_map
29
+ attribute_map
30
+ end
31
+
32
+ # Returns all the JSON keys this model knows about
33
+ def self.acceptable_attributes
34
+ acceptable_attribute_map.values
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.openapi_types
39
+ {
40
+ :'topup' => :'ListTopups200ResponseTopupsInner'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateTopup200Response` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ acceptable_attribute_map = self.class.acceptable_attribute_map
59
+ attributes = attributes.each_with_object({}) { |(k, v), h|
60
+ if (!acceptable_attribute_map.key?(k.to_sym))
61
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateTopup200Response`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
62
+ end
63
+ h[k.to_sym] = v
64
+ }
65
+
66
+ if attributes.key?(:'topup')
67
+ self.topup = attributes[:'topup']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
75
+ invalid_properties = Array.new
76
+ invalid_properties
77
+ end
78
+
79
+ # Check to see if the all the properties in the model are valid
80
+ # @return true if the model is valid
81
+ def valid?
82
+ warn '[DEPRECATED] the `valid?` method is obsolete'
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ topup == o.topup
92
+ end
93
+
94
+ # @see the `==` method
95
+ # @param [Object] Object to be compared
96
+ def eql?(o)
97
+ self == o
98
+ end
99
+
100
+ # Calculates hash code according to all attributes.
101
+ # @return [Integer] Hash code
102
+ def hash
103
+ [topup].hash
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def self.build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ transformed_hash = {}
113
+ openapi_types.each_pair do |key, type|
114
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
115
+ transformed_hash["#{key}"] = nil
116
+ elsif type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[attribute_map[key]].is_a?(Array)
120
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
121
+ end
122
+ elsif !attributes[attribute_map[key]].nil?
123
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
124
+ end
125
+ end
126
+ new(transformed_hash)
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def self._deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = Tremendous.const_get(type)
168
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end