This client library is a Ruby gem which can be compiled and used in your Ruby and Ruby on Rails project. This library requires a few gems from the RubyGems repository.
- Open the command line interface or the terminal and navigate to the folder containing the source code.
- Run
gem build genius_referrals.gemspec
to build the gem. - Once built, the gem can be installed on the current work environment using
gem install genius_referrals-1.0.0.gem
The following section explains how to use the GeniusReferrals Ruby Gem in a new Rails project using RubyMine™. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Close any existing projects in RubyMine™ by selecting File -> Close Project
. Next, click on Create New Project
to create a new project from scratch.
Next, provide TestApp
as the project name, choose Rails Application
as the project type, and click OK
.
In the next dialog make sure that correct Ruby SDK is being used (minimum 2.0.0) and click OK
.
This will create a new Rails Application project with an existing set of files and folder.
In order to use the GeniusReferrals gem in the new project we must add a gem reference. Locate the Gemfile
in the Project Explorer window under the TestApp
project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line: gem 'genius_referrals', '~> 1.0.0'
Once the TestApp
project is created, a folder named controllers
will be visible in the Project Explorer under the following path: TestApp > app > controllers
. Right click on this folder and select New -> Run Rails Generator...
.
Selecting the said option will popup a small window where the generator names are displayed. Here, select the controller
template.
Next, a popup window will ask you for a Controller name and included Actions. For controller name provide Hello
and include an action named Index
and click OK
.
A new controller class anmed HelloController
will be created in a file named hello_controller.rb
containing a method named Index
. In this method, add code for initialization and a sample for its usage.
You can test the generated SDK and the server with automatically generated test cases as follows:
- From terminal/cmd navigate to the root directory of the SDK.
- Invoke:
bundle exec rake
In order to setup authentication and initialization of the API client, you need the following information.
Parameter | Description |
---|---|
content_type | The content type |
x_auth_token | Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access |
API client can be initialized as following.
# Configuration parameters and credentials
content_type = "application/json"; # The content type
x_auth_token = "3b9d11374b602fb47b987dff90f1c5940a1f377f"; # Your API Token, you can get your token here https://www.geniusreferrals.com/en/settings/api-access
client = GeniusReferrals::GeniusReferralsClient.new(content_type, x_auth_token)
The added initlization code can be debugged by putting a breakpoint in the Index
method and running the project in debug mode by selecting Run -> Debug 'Development: TestApp'
.
- RootsController
- AuthenticationsController
- AdvocatesController
- AccountsController
- ReportsController
- ReferralsController
- RedemptionRequestsController
- BonusesController
- CampaignsController
The singleton instance of the RootsController
class can be accessed from the API Client.
roots = client.roots
The root of the API
def get_root; end
result = roots.get_root()
The singleton instance of the AuthenticationsController
class can be accessed from the API Client.
authentications = client.authentications
Allow clients to test authentication on Genius Referrals platform.
def get_authentication; end
result = authentications.get_authentication()
The singleton instance of the AdvocatesController
class can be accessed from the API Client.
advocates = client.advocates
Delete an advocate
def delete_advocate(account_slug,
advocate_token); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocates.delete_advocate(account_slug, advocate_token)
Update an advocate.
def put_advocate(account_slug,
advocate_token,
advocate_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
advocate_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_form = AdvocateForm.new
advocates.put_advocate(account_slug, advocate_token, advocate_form)
Create a new advocate.
def post_advocate(account_slug,
advocate_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_form = AdvocateForm.new
result = advocates.post_advocate(account_slug, advocate_form)
Get an advocate by a given token.
def get_advocate(account_slug,
advocate_token); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
result = advocates.get_advocate(account_slug, advocate_token)
Delete all advocates
def delete_advocates(account_slug); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
account_slug = 'account_slug'
advocates.delete_advocates(account_slug)
Get the list of advocates
def get_advocates(account_slug,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: name, lastname, email, advocate_token, bonus_exchange_method_slug, campaign_slug, can_refer, is_referral, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = advocates.get_advocates(account_slug, page, limit, filter, sort)
Update partial elements of an advocate.
def patch_advocate(account_slug,
advocate_token,
advocate_patch_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
advocate_patch_form | Required Collection |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_patch_form = [AdvocatePatchForm.new]
result = advocates.patch_advocate(account_slug, advocate_token, advocate_patch_form)
Get the advocates share links. These are the links that advocates use to share your services online. Share links are wrapped per campaign and widget package.
def get_share_links(account_slug,
advocate_token); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
result = advocates.get_share_links(account_slug, advocate_token)
Update a payment method.
def put_payment_method(account_slug,
advocate_token,
advocate_payment_method_id,
advocate_payment_method_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The advocate's token |
advocate_token | Required |
The advocate's token |
advocate_payment_method_id | Required |
The payment method's identifier |
advocate_payment_method_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_payment_method_id = 69
advocate_payment_method_form = PaymentMethodForm.new
advocates.put_payment_method(account_slug, advocate_token, advocate_payment_method_id, advocate_payment_method_form)
Get an advocate's payment method
def get_payment_method(account_slug,
advocate_token,
advocate_payment_method_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
advocate_payment_method_id | Required |
The payment method's identifier |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_payment_method_id = 69
result = advocates.get_payment_method(account_slug, advocate_token, advocate_payment_method_id)
Create a new payment method.
def post_payment_method(account_slug,
advocate_token,
advocate_payment_method_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
advocate_payment_method_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_payment_method_form = PaymentMethodForm.new
result = advocates.post_payment_method(account_slug, advocate_token, advocate_payment_method_form)
Get bonuses redemption method.
def get_bonus_redemption_method(bonuses_redemption_method_slug); end
Parameter | Tags | Description |
---|---|---|
bonuses_redemption_method_slug | Required |
The bonus redemption method's identifier |
bonuses_redemption_method_slug = 'bonuses_redemption_method_slug'
result = advocates.get_bonus_redemption_method(bonuses_redemption_method_slug)
Get bonuses redemption methods.
def get_bonus_redemption_methods; end
result = advocates.get_bonus_redemption_methods()
Get currencies.
def get_currencies; end
result = advocates.get_currencies()
Get a currency.
def get_currency(code); end
Parameter | Tags | Description |
---|---|---|
code | Required |
The currency's code |
code = 'code'
result = advocates.get_currency(code)
Get the advocate's payment methods.
def get_payment_methods(account_slug,
advocate_token,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: username, is_active. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: username, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = advocates.get_payment_methods(account_slug, advocate_token, page, limit, filter, sort)
The singleton instance of the AccountsController
class can be accessed from the API Client.
accounts = client.accounts
Get an account by a given slug.
def get_account(account_slug); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
account_slug = 'account_slug'
result = accounts.get_account(account_slug)
Get the list of accounts.
def get_accounts(page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: name. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: name, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort=last_name|first_name|-hire_date |
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = accounts.get_accounts(page, limit, filter, sort)
The singleton instance of the ReportsController
class can be accessed from the API Client.
reports = client.reports
Get referrals summary per referral origin.
def get_referrals_summary_per_origin(advocate_token); end
Parameter | Tags | Description |
---|---|---|
advocate_token | Required |
The advocate's token |
advocate_token = 'advocate_token'
result = reports.get_referrals_summary_per_origin(advocate_token)
Get bonuses summary per referral origin.
def get_bonuses_summary_per_origin(advocate_token); end
Parameter | Tags | Description |
---|---|---|
advocate_token | Required |
The advocate's token |
advocate_token = 'advocate_token'
result = reports.get_bonuses_summary_per_origin(advocate_token)
Get top 10 advocates.
def get_top_advocates(account_slug = nil,
campaign_slug = nil,
limit = 10,
from = nil,
to = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Optional |
The account identifier |
campaign_slug | Optional |
The campaign identifier |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10) |
from | Optional |
The datetime were the range of the search starts |
to | Optional |
The datetime were the range of the search stops |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
limit = 10
from = DateTime.now
to = DateTime.now
result = reports.get_top_advocates(account_slug, campaign_slug, limit, from, to)
Get share daily participation.
def get_share_daily_participation(account_slug = nil,
campaign_slug = nil,
advocate_token = nil,
from = nil,
to = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Optional |
The account identifier |
campaign_slug | Optional |
The campaign identifier |
advocate_token | Optional |
The advocate's token |
from | Optional |
The datetime were the range of the search starts |
to | Optional |
The datetime were the range of the search stops |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
advocate_token = 'advocate_token'
from = DateTime.now
to = DateTime.now
result = reports.get_share_daily_participation(account_slug, campaign_slug, advocate_token, from, to)
Get referral daily participation.
def get_referral_daily_participation(account_slug = nil,
campaign_slug = nil,
advocate_token = nil,
from = nil,
to = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Optional |
The account identifier |
campaign_slug | Optional |
The campaign identifier |
advocate_token | Optional |
The advocate's token |
from | Optional |
The datetime were the range of the search starts |
to | Optional |
The datetime were the range of the search stops |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
advocate_token = 'advocate_token'
from = DateTime.now
to = DateTime.now
result = reports.get_referral_daily_participation(account_slug, campaign_slug, advocate_token, from, to)
Get click daily participation.
def get_click_daily_participation(account_slug = nil,
campaign_slug = nil,
advocate_token = nil,
from = nil,
to = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Optional |
The account identifier |
campaign_slug | Optional |
The campaign identifier |
advocate_token | Optional |
The advocate's token |
from | Optional |
The datetime were the range of the search starts |
to | Optional |
The datetime were the range of the search stops |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
advocate_token = 'advocate_token'
from = DateTime.now
to = DateTime.now
result = reports.get_click_daily_participation(account_slug, campaign_slug, advocate_token, from, to)
Get bonuses daily given.
def get_bonuses_daily_given(account_slug = nil,
campaign_slug = nil,
advocate_token = nil,
from = nil,
to = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Optional |
The account identifier |
campaign_slug | Optional |
The campaign identifier |
advocate_token | Optional |
The advocate identifier |
from | Optional |
The datetime were the range of the search starts |
to | Optional |
The datetime were the range of the search stops |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
advocate_token = 'advocate_token'
from = DateTime.now
to = DateTime.now
result = reports.get_bonuses_daily_given(account_slug, campaign_slug, advocate_token, from, to)
The singleton instance of the ReferralsController
class can be accessed from the API Client.
referrals = client.referrals
Get a referral origin by a given slug.
def get_referral_origin(referral_origin_slug); end
Parameter | Tags | Description |
---|---|---|
referral_origin_slug | Required |
The referral origin identifier |
referral_origin_slug = 'referral_origin_slug'
result = referrals.get_referral_origin(referral_origin_slug)
Get referral origins. This is needed when creating (POST) a new referral, as referral_origin_slug refers to one of this origins.
def get_referral_origins; end
result = referrals.get_referral_origins()
Get a referral by a given id.
def get_referral(account_slug,
advocate_token,
referral_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
referral_id | Required |
The referral id |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_id = 'referral_id'
result = referrals.get_referral(account_slug, advocate_token, referral_id)
Delete a referral.
def delete_referral(account_slug,
advocate_token,
referral_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
referral_id | Required |
The referral identifier |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_id = 'referral_id'
referrals.delete_referral(account_slug, advocate_token, referral_id)
Create a new referral.
def post_referral(account_slug,
advocate_token,
referral_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
referral_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_form = ReferralForm.new
result = referrals.post_referral(account_slug, advocate_token, referral_form)
Update a referral.
def put_referral(account_slug,
advocate_token,
referral_id,
referral_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
referral_id | Required |
The referral id |
referral_form | Required |
The body of the request |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_id = 'referral_id'
referral_form = ReferralForm.new
referrals.put_referral(account_slug, advocate_token, referral_id, referral_form)
Get the list of referrals for a given advocate.
def get_referrals(account_slug,
advocate_token,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The advocate's token |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: url, referral_origin_slug, created. Use the following delimiters to build your filters params. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = referrals.get_referrals(account_slug, advocate_token, page, limit, filter, sort)
The singleton instance of the RedemptionRequestsController
class can be accessed from the API Client.
redemptionRequests = client.redemption_requests
Get a redemption request status.
def get_redemption_request_status(redemption_request_status_slug); end
Parameter | Tags | Description |
---|---|---|
redemption_request_status_slug | Required |
The redemption request status identifier |
redemption_request_status_slug = 'redemption_request_status_slug'
result = redemptionRequests.get_redemption_request_status(redemption_request_status_slug)
Get redemption request statuses.
def get_redemption_request_statuses; end
result = redemptionRequests.get_redemption_request_statuses()
Get a redemption request action.
def get_redemption_request_action(redemption_request_action_slug); end
Parameter | Tags | Description |
---|---|---|
redemption_request_action_slug | Required |
The redemption request action identifier |
redemption_request_action_slug = 'redemption_request_action_slug'
result = redemptionRequests.get_redemption_request_action(redemption_request_action_slug)
Get redemption request actions.
def get_redemption_request_actions; end
result = redemptionRequests.get_redemption_request_actions()
Redeem a redemption request. After the redemption request is created it needs to be redeemed. This will deduct the amount of the advocate unclaimed balance and move the request to the completed state.
def patch_redemption_request(account_slug,
redemption_request_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
redemption_request_id | Required |
The redemption request id |
account_slug = 'account_slug'
redemption_request_id = 27
redemptionRequests.patch_redemption_request(account_slug, redemption_request_id)
Create a redemption request.
def post_redemption_request(account_slug,
redemption_request_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
redemption_request_form | Required |
The body of the request |
account_slug = 'account_slug'
redemption_request_form = RedemptionRequestForm.new
result = redemptionRequests.post_redemption_request(account_slug, redemption_request_form)
Get a redemption request by a given id.
def get_redemption_request(account_slug,
redemption_request_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
redemption_request_id | Required |
The redemption request identifier |
account_slug = 'account_slug'
redemption_request_id = 'redemption_request_id'
result = redemptionRequests.get_redemption_request(account_slug, redemption_request_id)
Get the list of redemption requests.
def get_redemption_requests(account_slug,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: redemption_request_id, name, lastname, email, request_status_slug, request_action_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = redemptionRequests.get_redemption_requests(account_slug, page, limit, filter, sort)
The singleton instance of the BonusesController
class can be accessed from the API Client.
bonuses = client.bonuses
Get the list of bonuses for a given account.
def get_bonuses(account_slug,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: name, lastname, email, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: name, lastname, email, created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = bonuses.get_bonuses(account_slug, page, limit, filter, sort)
Make an attempt to give a bonus for to the advocate's referrer. The system processes the given advocate (referral) and creates a bonus for the advocate's referrer if is needed. All restrictions set on the campaigns for this account will be check out before giving the bonus to the advocate's referrer.
def post_bonus(account_slug,
bonuses_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
bonuses_form | Required |
The body of the request |
account_slug = 'account_slug'
bonuses_form = BonusesForm.new
result = bonuses.post_bonus(account_slug, bonuses_form)
Check if there is a bonus to be given to the advocate. Allows the clients to check if there is a bonus to be given, it simulates the behaivor of a POST request to /accounts/{account_slug}/bonuses resource. This resource is idempotent.
def get_bonus_checkup(account_slug,
advocate_token,
reference,
payment_amount); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
advocate_token | Required |
The referral's token. Usually the one that completed the purchase, or trigger an event. |
reference | Required |
The reference number for this request. Usually the order_id, payment_id, or timestamp. |
payment_amount | Required |
The payment amount the referrals has made. Required for a percentage based campaign. |
account_slug = 'account_slug'
advocate_token = 'advocate_token'
reference = 'reference'
payment_amount = 27.579617163902
result = bonuses.get_bonus_checkup(account_slug, advocate_token, reference, payment_amount)
Force the system to give a bonus to an advocate. The system will not take into account the restriccions specified on the campaigns.
def post_force_bonus(account_slug,
bonus_form); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
bonus_form | Required |
The body of the request |
account_slug = 'account_slug'
bonus_form = ForceBonusesForm.new
result = bonuses.post_force_bonus(account_slug, bonus_form)
Get a bonus request trace.
def get_bonus_trace(account_slug,
trace_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
trace_id | Required |
The trace id |
account_slug = 'account_slug'
trace_id = 27
result = bonuses.get_bonus_trace(account_slug, trace_id)
Delete a bonus
def delete_bonus(account_slug,
bonus_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
bonus_id | Required |
The bonus id |
account_slug = 'account_slug'
bonus_id = 27
bonuses.delete_bonus(account_slug, bonus_id)
Get a bonus by a given id.
def get_bonus(account_slug,
bonus_id); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
bonus_id | Required |
The bonus id |
account_slug = 'account_slug'
bonus_id = 27
result = bonuses.get_bonus(account_slug, bonus_id)
Get the list of bonuses traces (audit trail). Every time the system tries to give a bonus the an advocate a new trace is created.
def get_bonus_traces(account_slug,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: reference, result, bonus_amount, advocate_token, advocate_referrer_token, campaign_slug, from, to, created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: created. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = bonuses.get_bonus_traces(account_slug, page, limit, filter, sort)
The singleton instance of the CampaignsController
class can be accessed from the API Client.
campaigns = client.campaigns
Get a campaign by a given slug.
def get_campaign(account_slug,
campaign_slug); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
campaign_slug | Required |
The campaign identifier |
account_slug = 'account_slug'
campaign_slug = 'campaign_slug'
result = campaigns.get_campaign(account_slug, campaign_slug)
Get the list of campaings for a given account.
def get_campaigns(account_slug,
page = 1,
limit = 10,
filter = nil,
sort = nil); end
Parameter | Tags | Description |
---|---|---|
account_slug | Required |
The account identifier |
page | Optional DefaultValue |
Page number, e.g. 1 would start at the first result, and 10 would start at the tenth result. |
limit | Optional DefaultValue |
Maximum number of results to return in the response. Default (10), threshold (100) |
filter | Optional |
Allowed fields: name, description, start_date, end_date, is_active (true|false), created. Use the following delimiters to build your filters params. The vertical bar ('|') to separate individual filter phrases and a double colon ('::') to separate the names and values. The delimiter of the double colon (':') separates the property name from the comparison value, enabling the comparison value to contain spaces. Example: www.example.com/users?filter='name::todd|city::denver|title::grand poobah' |
sort | Optional |
Allowed fields: campaign_slug, created, start_date, end_date, is_active. Use sort query-string parameter that contains a delimited set of property names. For each property name, sort in ascending order, and for each property prefixed with a dash ('-') sort in descending order. Separate each property name with a vertical bar ('|'), which is consistent with the separation of the name|value pairs in filtering, above. For example, if we want to retrieve users in order of their last name (ascending), first name (ascending) and hire date (descending), the request might look like this www.example.com/users?sort='last_name|first_name|-hire_date' |
account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'
result = campaigns.get_campaigns(account_slug, page, limit, filter, sort)