tremendous_ruby 5.14.0 → 5.16.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 +4 -4
- data/lib/tremendous/api/tremendous_api.rb +70 -2
- data/lib/tremendous/models/create_field.rb +320 -0
- data/lib/tremendous/models/create_field200_response.rb +237 -0
- data/lib/tremendous/models/create_field_request.rb +320 -0
- data/lib/tremendous/models/create_field_request_data.rb +224 -0
- data/lib/tremendous/models/create_order200_response_order_rewards_inner.rb +12 -1
- data/lib/tremendous/models/currency_codes.rb +1 -2
- data/lib/tremendous/models/field.rb +37 -5
- data/lib/tremendous/models/list_fields200_response_fields_inner.rb +37 -5
- data/lib/tremendous/models/list_fields200_response_fields_inner_data.rb +236 -0
- data/lib/tremendous/models/list_products_response_products_inner.rb +1 -1
- data/lib/tremendous/models/list_rewards200_response_rewards_inner.rb +12 -1
- data/lib/tremendous/models/list_rewards200_response_rewards_inner_value.rb +2 -2
- data/lib/tremendous/models/order_with_link_rewards_inner.rb +12 -1
- data/lib/tremendous/models/order_without_link_rewards_inner.rb +12 -1
- data/lib/tremendous/models/product.rb +1 -1
- data/lib/tremendous/models/reward.rb +12 -1
- data/lib/tremendous/models/reward_base.rb +12 -1
- data/lib/tremendous/models/reward_for_order_create.rb +12 -1
- data/lib/tremendous/models/reward_value.rb +2 -2
- data/lib/tremendous/models/reward_with_link.rb +12 -1
- data/lib/tremendous/models/reward_without_link.rb +12 -1
- data/lib/tremendous/version.rb +1 -1
- data/lib/tremendous.rb +5 -0
- metadata +6 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e7206793c4732502082c66c84a0b389256377d04a907c08f41ef3fe394dd305f
|
|
4
|
+
data.tar.gz: 4dac1e9ff3ac43f3424a65ac9d478030ce2f6488b4639eb98d375f37f2b4de6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1f48b822017e2ec610a20c9fec86b4346e04d1b28c9e5a4805aa00118c33dded7281fe581fc4e3c0427da3e2d8becf21ebcaf5875d25db6c8fba3fdc98f30cd
|
|
7
|
+
data.tar.gz: '09990b38d8b3651e2ed21f4a281d7c8aac84f3b60008adfbda79ad38efd411324ba745644432f0c2d2387d35fc53432f3deb47bb30a19ec5edf811514c27f53e'
|
|
@@ -551,6 +551,74 @@ module Tremendous
|
|
|
551
551
|
return data, status_code, headers
|
|
552
552
|
end
|
|
553
553
|
|
|
554
|
+
# Create field
|
|
555
|
+
# Create a custom field to be associated with rewards. Custom fields can be used for reporting and analytics purposes.
|
|
556
|
+
# @param create_field_request [CreateFieldRequest] Field details
|
|
557
|
+
# @param [Hash] opts the optional parameters
|
|
558
|
+
# @return [CreateField200Response]
|
|
559
|
+
def create_field(create_field_request, opts = {})
|
|
560
|
+
data, _status_code, _headers = create_field_with_http_info(create_field_request, opts)
|
|
561
|
+
data
|
|
562
|
+
end
|
|
563
|
+
|
|
564
|
+
# Create field
|
|
565
|
+
# Create a custom field to be associated with rewards. Custom fields can be used for reporting and analytics purposes.
|
|
566
|
+
# @param create_field_request [CreateFieldRequest] Field details
|
|
567
|
+
# @param [Hash] opts the optional parameters
|
|
568
|
+
# @return [Array<(CreateField200Response, Integer, Hash)>] CreateField200Response data, response status code and response headers
|
|
569
|
+
def create_field_with_http_info(create_field_request, opts = {})
|
|
570
|
+
if @api_client.config.debugging
|
|
571
|
+
@api_client.config.logger.debug 'Calling API: TremendousApi.create_field ...'
|
|
572
|
+
end
|
|
573
|
+
# verify the required parameter 'create_field_request' is set
|
|
574
|
+
if @api_client.config.client_side_validation && create_field_request.nil?
|
|
575
|
+
fail ArgumentError, "Missing the required parameter 'create_field_request' when calling TremendousApi.create_field"
|
|
576
|
+
end
|
|
577
|
+
# resource path
|
|
578
|
+
local_var_path = '/fields'
|
|
579
|
+
|
|
580
|
+
# query parameters
|
|
581
|
+
query_params = opts[:query_params] || {}
|
|
582
|
+
|
|
583
|
+
# header parameters
|
|
584
|
+
header_params = opts[:header_params] || {}
|
|
585
|
+
# HTTP header 'Accept' (if needed)
|
|
586
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
587
|
+
# HTTP header 'Content-Type'
|
|
588
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
589
|
+
if !content_type.nil?
|
|
590
|
+
header_params['Content-Type'] = content_type
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
# form parameters
|
|
594
|
+
form_params = opts[:form_params] || {}
|
|
595
|
+
|
|
596
|
+
# http body (model)
|
|
597
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_field_request)
|
|
598
|
+
|
|
599
|
+
# return_type
|
|
600
|
+
return_type = opts[:debug_return_type] || 'CreateField200Response'
|
|
601
|
+
|
|
602
|
+
# auth_names
|
|
603
|
+
auth_names = opts[:debug_auth_names] || ['BearerApiKey']
|
|
604
|
+
|
|
605
|
+
new_options = opts.merge(
|
|
606
|
+
:operation => :"TremendousApi.create_field",
|
|
607
|
+
:header_params => header_params,
|
|
608
|
+
:query_params => query_params,
|
|
609
|
+
:form_params => form_params,
|
|
610
|
+
:body => post_body,
|
|
611
|
+
:auth_names => auth_names,
|
|
612
|
+
:return_type => return_type
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
616
|
+
if @api_client.config.debugging
|
|
617
|
+
@api_client.config.logger.debug "API called: TremendousApi#create_field\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
618
|
+
end
|
|
619
|
+
return data, status_code, headers
|
|
620
|
+
end
|
|
621
|
+
|
|
554
622
|
# Create invoice
|
|
555
623
|
# 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
624
|
# @param create_invoice_request [CreateInvoiceRequest] Invoice details
|
|
@@ -688,7 +756,7 @@ module Tremendous
|
|
|
688
756
|
end
|
|
689
757
|
|
|
690
758
|
# Create order
|
|
691
|
-
# 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's balance.</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">reward</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>A single reward, sent to a recipient. A reward is always part of an order.</p> <p>Either <code>products</code> or <code>campaign_id</code> must be specified.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the reward</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">order_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the order this reward is part of.</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">created_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date-time</span></td><td><p>Date the reward was created</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">campaign_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">products</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.</p> <p>Providing a <code>products</code> array will override the products made available by the campaign specified using the <code>campaign_id</code> property unless the <code>products</code> array is empty. It will <em>not</em> override other campaign attributes, like the message and customization of the look and feel.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">denomination</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the reward</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency_code</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the reward</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">recipient</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details of the recipient of the reward</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Name of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">email</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Email address of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">phone</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">deliver_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">custom_fields</code> </div> </td><td><span class=\"property-type\">array</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show array item type</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the custom field</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Value of the custom field</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">label</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Label of the custom field</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">language</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Set this to translate the redemption experience for this reward. Pass a 2-letter <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">ISO-639-1 code</a> for the desired language. Defaults to <code>en</code>.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details on how the reward is delivered to the recipient.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>How to deliver the reward to the recipient.</p> <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">meta</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Customizable reward delivery metadata, taking precedence over the related campaign settings.</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\">sender_name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The "sender name" used in the delivery. If it's an email reward, "via Tremendous" will be appended to the value. Please note that you cannot customize the sender email.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">subject_line</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The subject line used in the delivery.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">message</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The content of the message of the reward, shown in the email / SMS and on the landing page.</p> </td></tr> </tbody> </table> </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://developers.tremendous.com/reference/list-funding-sources). 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://developers.tremendous.com/docs/sandbox-environment). 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 not create a new order. If the payload is the same as a previously issued order, our API will return a `201` response code, along with a representation of the already-existing order in the response body. If the `external_id` used is for an order with different parameters (e.g. amount, recipient), our API will return a `409` response code, indicating a conflicting resource.
|
|
759
|
+
# 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'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-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">expires_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date-time</span></td><td><p>Expiration date of the reward. If null, the reward does not expire.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">campaign_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">products</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.</p> <p>Providing a <code>products</code> array will override the products made available by the campaign specified using the <code>campaign_id</code> property unless the <code>products</code> array is empty. It will <em>not</em> override other campaign attributes, like the message and customization of the look and feel.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">denomination</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the reward</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency_code</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the reward</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">recipient</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details of the recipient of the reward</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Name of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">email</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Email address of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">phone</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">deliver_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">custom_fields</code> </div> </td><td><span class=\"property-type\">array</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show array item type</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the custom field</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Value of the custom field</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">label</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Label of the custom field</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">language</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Set this to translate the redemption experience for this reward. Pass a 2-letter <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">ISO-639-1 code</a> for the desired language. Defaults to <code>en</code>.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details on how the reward is delivered to the recipient.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>How to deliver the reward to the recipient.</p> <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">meta</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Customizable reward delivery metadata, taking precedence over the related campaign settings.</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\">sender_name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The "sender name" used in the delivery. If it's an email reward, "via Tremendous" will be appended to the value. Please note that you cannot customize the sender email.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">subject_line</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The subject line used in the delivery.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">message</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The content of the message of the reward, shown in the email / SMS and on the landing page.</p> </td></tr> </tbody> </table> </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://developers.tremendous.com/reference/list-funding-sources). 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://developers.tremendous.com/docs/sandbox-environment). 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 not create a new order. If the payload is the same as a previously issued order, our API will return a `201` response code, along with a representation of the already-existing order in the response body. If the `external_id` used is for an order with different parameters (e.g. amount, recipient), our API will return a `409` response code, indicating a conflicting resource.
|
|
692
760
|
# @param create_order_request [CreateOrderRequest] Order to create
|
|
693
761
|
# @param [Hash] opts the optional parameters
|
|
694
762
|
# @return [CreateOrder200Response]
|
|
@@ -698,7 +766,7 @@ module Tremendous
|
|
|
698
766
|
end
|
|
699
767
|
|
|
700
768
|
# Create order
|
|
701
|
-
# Every time you want to send out a reward through Tremendous you need to create an order for it. > 📘 Getting started with your first order > > Our step-by-step guide walks you through everything you need > to send your first gift card through the Tremendous API: > > <strong><a style=\"display: block; margin-top: 20px;\" href=\"/docs/sending-rewards-intro\">Check it out!</a></strong> ## Request body <div class=\"object-schema-request-schema\"> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">external_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Reference for this order, supplied by the customer.</p> <p>When set, <code>external_id</code> makes order idempotent. All requests that use the same <code>external_id</code> after the initial order creation, will result in a response that returns the data of the initially created order. The response will have a <code>201</code> response code. These responses <strong>fail</strong> to create any further orders.</p> <p>It also allows for retrieving by <code>external_id</code> instead of <code>id</code> only.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">payment</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">funding_source_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the funding source that will be used to pay for the order. Use <code>balance</code> to use your Tremendous&#39;s balance.</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">reward</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>A single reward, sent to a recipient. A reward is always part of an order.</p> <p>Either <code>products</code> or <code>campaign_id</code> must be specified.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the reward</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">order_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the order this reward is part of.</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">created_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date-time</span></td><td><p>Date the reward was created</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">campaign_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">products</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.</p> <p>Providing a <code>products</code> array will override the products made available by the campaign specified using the <code>campaign_id</code> property unless the <code>products</code> array is empty. It will <em>not</em> override other campaign attributes, like the message and customization of the look and feel.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">denomination</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the reward</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency_code</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the reward</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">recipient</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details of the recipient of the reward</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Name of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">email</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Email address of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">phone</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">deliver_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">custom_fields</code> </div> </td><td><span class=\"property-type\">array</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show array item type</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the custom field</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Value of the custom field</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">label</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Label of the custom field</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">language</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Set this to translate the redemption experience for this reward. Pass a 2-letter <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">ISO-639-1 code</a> for the desired language. Defaults to <code>en</code>.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details on how the reward is delivered to the recipient.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>How to deliver the reward to the recipient.</p> <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">meta</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Customizable reward delivery metadata, taking precedence over the related campaign settings.</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\">sender_name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The &quot;sender name&quot; used in the delivery. If it&#39;s an email reward, &quot;via Tremendous&quot; will be appended to the value. Please note that you cannot customize the sender email.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">subject_line</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The subject line used in the delivery.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">message</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The content of the message of the reward, shown in the email / SMS and on the landing page.</p> </td></tr> </tbody> </table> </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://developers.tremendous.com/reference/list-funding-sources). 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://developers.tremendous.com/docs/sandbox-environment). 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 not create a new order. If the payload is the same as a previously issued order, our API will return a `201` response code, along with a representation of the already-existing order in the response body. If the `external_id` used is for an order with different parameters (e.g. amount, recipient), our API will return a `409` response code, indicating a conflicting resource.
|
|
769
|
+
# 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-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">expires_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date-time</span></td><td><p>Expiration date of the reward. If null, the reward does not expire.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">campaign_id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.</p> </td></tr> <tr class=\"property-conditional-hint-request-only\"><td><div class=\"property-name\"> <code class=\"property-name\">products</code> </div> </td><td><span class=\"property-type\">array</span> <span class=\"property-format\">string</span></td><td><p>List of IDs of product (different gift cards, charity, etc.) that will be available to the recipient to choose from.</p> <p>Providing a <code>products</code> array will override the products made available by the campaign specified using the <code>campaign_id</code> property unless the <code>products</code> array is empty. It will <em>not</em> override other campaign attributes, like the message and customization of the look and feel.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">object</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">denomination</code> </div> </td><td><span class=\"property-type\">number</span> <span class=\"property-format\">double</span></td><td><p>Amount of the reward</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">currency_code</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Currency of the reward</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">recipient</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details of the recipient of the reward</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Name of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">email</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Email address of the recipient</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">phone</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Phone number of the recipient. For non-US phone numbers, specify the country code (prefixed with +).</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">deliver_at</code> </div> </td><td><span class=\"property-type\">string</span> <span class=\"property-format\">date</span></td><td><p>Timestamp of reward delivery within the next year. Note that if date-time is provided, the time values will be ignored.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">custom_fields</code> </div> </td><td><span class=\"property-type\">array</span></td><td></td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show array item type</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">id</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Tremendous ID of the custom field</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">value</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Value of the custom field</p> </td></tr> <tr class=\"property-conditional-hint-response-only\"><td><div class=\"property-name\"> <code class=\"property-name\">label</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Label of the custom field</p> </td></tr> </tbody> </table> </tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">language</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>Set this to translate the redemption experience for this reward. Pass a 2-letter <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">ISO-639-1 code</a> for the desired language. Defaults to <code>en</code>.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">delivery</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Details on how the reward is delivered to the recipient.</p> </td></tr> <tr> <td colspan=\"3\"> <details> <summary>Show object properties</summary> <table> <thead> <tr> <th>Property</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody class=\"object-schema-table-body\"> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">method</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>How to deliver the reward to the recipient.</p> <table> <thead> <tr> <th>Delivery Method</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>EMAIL</code></td> <td>Deliver the reward to the recipient by email</td> </tr> <tr> <td><code>LINK</code></td> <td> <p>Deliver the reward to the recipient via a link.</p> <p>The link can be retrieved on a successfully ordered reward via the <code>/rewards</code> or <code>/rewards/{id}</code> endpoint. That link must then be delivered to the recipient out-of-band.</p> </td> </tr> <tr> <td><code>PHONE</code></td> <td>Deliver the reward to the recipient by SMS</td> </tr> </tbody> </table> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">meta</code> </div> </td><td><span class=\"property-type\">object</span></td><td><p>Customizable reward delivery metadata, taking precedence over the related campaign settings.</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\">sender_name</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The &quot;sender name&quot; used in the delivery. If it&#39;s an email reward, &quot;via Tremendous&quot; will be appended to the value. Please note that you cannot customize the sender email.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">subject_line</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The subject line used in the delivery.</p> </td></tr> <tr class=\"\"><td><div class=\"property-name\"> <code class=\"property-name\">message</code> </div> </td><td><span class=\"property-type\">string</span></td><td><p>The content of the message of the reward, shown in the email / SMS and on the landing page.</p> </td></tr> </tbody> </table> </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://developers.tremendous.com/reference/list-funding-sources). 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://developers.tremendous.com/docs/sandbox-environment). 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 not create a new order. If the payload is the same as a previously issued order, our API will return a `201` response code, along with a representation of the already-existing order in the response body. If the `external_id` used is for an order with different parameters (e.g. amount, recipient), our API will return a `409` response code, indicating a conflicting resource.
|
|
702
770
|
# @param create_order_request [CreateOrderRequest] Order to create
|
|
703
771
|
# @param [Hash] opts the optional parameters
|
|
704
772
|
# @return [Array<(CreateOrder200Response, Integer, Hash)>] CreateOrder200Response data, response status code and response headers
|
|
@@ -0,0 +1,320 @@
|
|
|
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 CreateField
|
|
18
|
+
# A human-readable name for the field. Can contain letters, numbers, spaces, and underscores. The field's `label` (a reference name used in API requests) will be automatically derived from this value.
|
|
19
|
+
attr_accessor :display_name
|
|
20
|
+
|
|
21
|
+
# Type of the values of the field <table> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>Checkbox</code></td> <td>A boolean value (true/false)</td> </tr> <tr> <td><code>Currency</code></td> <td>A monetary value</td> </tr> <tr> <td><code>Date</code></td> <td>A date value</td> </tr> <tr> <td><code>Dropdown</code></td> <td>A single selection from predefined options (see <code>data.options</code>)</td> </tr> <tr> <td><code>Email</code></td> <td>An email address</td> </tr> <tr> <td><code>List</code></td> <td>Multiple selections from predefined options (see <code>data.options</code>)</td> </tr> <tr> <td><code>Number</code></td> <td>A numeric value</td> </tr> <tr> <td><code>Phone</code></td> <td>A phone number</td> </tr> <tr> <td><code>Text</code></td> <td>A single-line text value</td> </tr> <tr> <td><code>TextArea</code></td> <td>A multi-line text value</td> </tr> </tbody> </table>
|
|
22
|
+
attr_accessor :data_type
|
|
23
|
+
|
|
24
|
+
attr_accessor :data
|
|
25
|
+
|
|
26
|
+
# Is this field required (true) or optional (false). Defaults to false.
|
|
27
|
+
attr_accessor :required
|
|
28
|
+
|
|
29
|
+
# A description of the field's purpose
|
|
30
|
+
attr_accessor :description
|
|
31
|
+
|
|
32
|
+
class EnumAttributeValidator
|
|
33
|
+
attr_reader :datatype
|
|
34
|
+
attr_reader :allowable_values
|
|
35
|
+
|
|
36
|
+
def initialize(datatype, allowable_values)
|
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
|
38
|
+
case datatype.to_s
|
|
39
|
+
when /Integer/i
|
|
40
|
+
value.to_i
|
|
41
|
+
when /Float/i
|
|
42
|
+
value.to_f
|
|
43
|
+
else
|
|
44
|
+
value
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def valid?(value)
|
|
50
|
+
!value || allowable_values.include?(value)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
55
|
+
def self.attribute_map
|
|
56
|
+
{
|
|
57
|
+
:'display_name' => :'display_name',
|
|
58
|
+
:'data_type' => :'data_type',
|
|
59
|
+
:'data' => :'data',
|
|
60
|
+
:'required' => :'required',
|
|
61
|
+
:'description' => :'description'
|
|
62
|
+
}
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Returns attribute mapping this model knows about
|
|
66
|
+
def self.acceptable_attribute_map
|
|
67
|
+
attribute_map
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Returns all the JSON keys this model knows about
|
|
71
|
+
def self.acceptable_attributes
|
|
72
|
+
acceptable_attribute_map.values
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Attribute type mapping.
|
|
76
|
+
def self.openapi_types
|
|
77
|
+
{
|
|
78
|
+
:'display_name' => :'String',
|
|
79
|
+
:'data_type' => :'String',
|
|
80
|
+
:'data' => :'CreateFieldRequestData',
|
|
81
|
+
:'required' => :'Boolean',
|
|
82
|
+
:'description' => :'String'
|
|
83
|
+
}
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List of attributes with nullable: true
|
|
87
|
+
def self.openapi_nullable
|
|
88
|
+
Set.new([
|
|
89
|
+
])
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Initializes the object
|
|
93
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
94
|
+
def initialize(attributes = {})
|
|
95
|
+
if (!attributes.is_a?(Hash))
|
|
96
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Tremendous::CreateField` initialize method"
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
100
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
101
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
102
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
103
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Tremendous::CreateField`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
104
|
+
end
|
|
105
|
+
h[k.to_sym] = v
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if attributes.key?(:'display_name')
|
|
109
|
+
self.display_name = attributes[:'display_name']
|
|
110
|
+
else
|
|
111
|
+
self.display_name = nil
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'data_type')
|
|
115
|
+
self.data_type = attributes[:'data_type']
|
|
116
|
+
else
|
|
117
|
+
self.data_type = nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'data')
|
|
121
|
+
self.data = attributes[:'data']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'required')
|
|
125
|
+
self.required = attributes[:'required']
|
|
126
|
+
else
|
|
127
|
+
self.required = false
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if attributes.key?(:'description')
|
|
131
|
+
self.description = attributes[:'description']
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
136
|
+
# @return Array for valid properties with the reasons
|
|
137
|
+
def list_invalid_properties
|
|
138
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
139
|
+
invalid_properties = Array.new
|
|
140
|
+
if @display_name.nil?
|
|
141
|
+
invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
if @data_type.nil?
|
|
145
|
+
invalid_properties.push('invalid value for "data_type", data_type cannot be nil.')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
invalid_properties
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Check to see if the all the properties in the model are valid
|
|
152
|
+
# @return true if the model is valid
|
|
153
|
+
def valid?
|
|
154
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
155
|
+
return false if @display_name.nil?
|
|
156
|
+
return false if @data_type.nil?
|
|
157
|
+
data_type_validator = EnumAttributeValidator.new('String', ["Checkbox", "Currency", "Date", "Dropdown", "Email", "List", "Number", "Phone", "Text", "TextArea"])
|
|
158
|
+
return false unless data_type_validator.valid?(@data_type)
|
|
159
|
+
true
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Custom attribute writer method with validation
|
|
163
|
+
# @param [Object] display_name Value to be assigned
|
|
164
|
+
def display_name=(display_name)
|
|
165
|
+
if display_name.nil?
|
|
166
|
+
fail ArgumentError, 'display_name cannot be nil'
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
@display_name = display_name
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
173
|
+
# @param [Object] data_type Object to be assigned
|
|
174
|
+
def data_type=(data_type)
|
|
175
|
+
validator = EnumAttributeValidator.new('String', ["Checkbox", "Currency", "Date", "Dropdown", "Email", "List", "Number", "Phone", "Text", "TextArea"])
|
|
176
|
+
unless validator.valid?(data_type)
|
|
177
|
+
fail ArgumentError, "invalid value for \"data_type\", must be one of #{validator.allowable_values}."
|
|
178
|
+
end
|
|
179
|
+
@data_type = data_type
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Checks equality by comparing each attribute.
|
|
183
|
+
# @param [Object] Object to be compared
|
|
184
|
+
def ==(o)
|
|
185
|
+
return true if self.equal?(o)
|
|
186
|
+
self.class == o.class &&
|
|
187
|
+
display_name == o.display_name &&
|
|
188
|
+
data_type == o.data_type &&
|
|
189
|
+
data == o.data &&
|
|
190
|
+
required == o.required &&
|
|
191
|
+
description == o.description
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# @see the `==` method
|
|
195
|
+
# @param [Object] Object to be compared
|
|
196
|
+
def eql?(o)
|
|
197
|
+
self == o
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Calculates hash code according to all attributes.
|
|
201
|
+
# @return [Integer] Hash code
|
|
202
|
+
def hash
|
|
203
|
+
[display_name, data_type, data, required, description].hash
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Builds the object from hash
|
|
207
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
208
|
+
# @return [Object] Returns the model itself
|
|
209
|
+
def self.build_from_hash(attributes)
|
|
210
|
+
return nil unless attributes.is_a?(Hash)
|
|
211
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
212
|
+
transformed_hash = {}
|
|
213
|
+
openapi_types.each_pair do |key, type|
|
|
214
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
215
|
+
transformed_hash["#{key}"] = nil
|
|
216
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
217
|
+
# check to ensure the input is an array given that the attribute
|
|
218
|
+
# is documented as an array but the input is not
|
|
219
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
220
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
221
|
+
end
|
|
222
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
223
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
new(transformed_hash)
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Deserializes the data based on type
|
|
230
|
+
# @param string type Data type
|
|
231
|
+
# @param string value Value to be deserialized
|
|
232
|
+
# @return [Object] Deserialized data
|
|
233
|
+
def self._deserialize(type, value)
|
|
234
|
+
case type.to_sym
|
|
235
|
+
when :Time
|
|
236
|
+
Time.parse(value)
|
|
237
|
+
when :Date
|
|
238
|
+
Date.parse(value)
|
|
239
|
+
when :String
|
|
240
|
+
value.to_s
|
|
241
|
+
when :Integer
|
|
242
|
+
value.to_i
|
|
243
|
+
when :Float
|
|
244
|
+
value.to_f
|
|
245
|
+
when :Boolean
|
|
246
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
247
|
+
true
|
|
248
|
+
else
|
|
249
|
+
false
|
|
250
|
+
end
|
|
251
|
+
when :Object
|
|
252
|
+
# generic object (usually a Hash), return directly
|
|
253
|
+
value
|
|
254
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
255
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
256
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
257
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
258
|
+
k_type = Regexp.last_match[:k_type]
|
|
259
|
+
v_type = Regexp.last_match[:v_type]
|
|
260
|
+
{}.tap do |hash|
|
|
261
|
+
value.each do |k, v|
|
|
262
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
else # model
|
|
266
|
+
# models (e.g. Pet) or oneOf
|
|
267
|
+
klass = Tremendous.const_get(type)
|
|
268
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Returns the string representation of the object
|
|
273
|
+
# @return [String] String presentation of the object
|
|
274
|
+
def to_s
|
|
275
|
+
to_hash.to_s
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
279
|
+
# @return [Hash] Returns the object in the form of hash
|
|
280
|
+
def to_body
|
|
281
|
+
to_hash
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Returns the object in the form of hash
|
|
285
|
+
# @return [Hash] Returns the object in the form of hash
|
|
286
|
+
def to_hash
|
|
287
|
+
hash = {}
|
|
288
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
289
|
+
value = self.send(attr)
|
|
290
|
+
if value.nil?
|
|
291
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
292
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
hash[param] = _to_hash(value)
|
|
296
|
+
end
|
|
297
|
+
hash
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# Outputs non-array value in the form of hash
|
|
301
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
302
|
+
# @param [Object] value Any valid value
|
|
303
|
+
# @return [Hash] Returns the value in the form of hash
|
|
304
|
+
def _to_hash(value)
|
|
305
|
+
if value.is_a?(Array)
|
|
306
|
+
value.compact.map { |v| _to_hash(v) }
|
|
307
|
+
elsif value.is_a?(Hash)
|
|
308
|
+
{}.tap do |hash|
|
|
309
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
310
|
+
end
|
|
311
|
+
elsif value.respond_to? :to_hash
|
|
312
|
+
value.to_hash
|
|
313
|
+
else
|
|
314
|
+
value
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
end
|