Skip to content

GeniusReferrals/Genius-Referrals-RUBY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

How to Build

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.

  1. Open the command line interface or the terminal and navigate to the folder containing the source code.
  2. Run gem build genius_referrals.gemspec to build the gem.
  3. Once built, the gem can be installed on the current work environment using gem install genius_referrals-1.0.0.gem

Building Gem

How to Use

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.

1. Starting a new project

Close any existing projects in RubyMine™ by selecting File -> Close Project. Next, click on Create New Project to create a new project from scratch.

Create a new project in RubyMine

Next, provide TestApp as the project name, choose Rails Application as the project type, and click OK.

Create a new Rails Application in RubyMine - step 1

In the next dialog make sure that correct Ruby SDK is being used (minimum 2.0.0) and click OK.

Create a new Rails Application in RubyMine - step 2

This will create a new Rails Application project with an existing set of files and folder.

2. Add reference of the gem

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'

Add references of the Gemfile

3. Adding a new Rails Controller

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....

Run Rails Generator on Controllers Folder

Selecting the said option will popup a small window where the generator names are displayed. Here, select the controller template.

Create a new Controller

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.

Add a new Controller

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.

Initialize the library

How to Test

You can test the generated SDK and the server with automatically generated test cases as follows:

  1. From terminal/cmd navigate to the root directory of the SDK.
  2. Invoke: bundle exec rake

Initialization

Authentication

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'.

Debug the TestApp

Class Reference

List of Controllers

Class: RootsController

Get singleton instance

The singleton instance of the RootsController class can be accessed from the API Client.

roots = client.roots

Method: get_root

The root of the API

def get_root; end

Example Usage

result = roots.get_root()

Back to List of Controllers

Class: AuthenticationsController

Get singleton instance

The singleton instance of the AuthenticationsController class can be accessed from the API Client.

authentications = client.authentications

Method: get_authentication

Allow clients to test authentication on Genius Referrals platform.

def get_authentication; end

Example Usage

result = authentications.get_authentication()

Back to List of Controllers

Class: AdvocatesController

Get singleton instance

The singleton instance of the AdvocatesController class can be accessed from the API Client.

advocates = client.advocates

Method: delete_advocate

Delete an advocate

def delete_advocate(account_slug, 
                        advocate_token); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'

advocates.delete_advocate(account_slug, advocate_token)

Method: put_advocate

Update an advocate.

def put_advocate(account_slug, 
                     advocate_token, 
                     advocate_form); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token
advocate_form Required The body of the request

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_form = AdvocateForm.new

advocates.put_advocate(account_slug, advocate_token, advocate_form)

Method: post_advocate

Create a new advocate.

def post_advocate(account_slug, 
                      advocate_form); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_form Required The body of the request

Example Usage

account_slug = 'account_slug'
advocate_form = AdvocateForm.new

result = advocates.post_advocate(account_slug, advocate_form)

Method: get_advocate

Get an advocate by a given token.

def get_advocate(account_slug, 
                     advocate_token); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'

result = advocates.get_advocate(account_slug, advocate_token)

Method: delete_advocates

Delete all advocates

def delete_advocates(account_slug); end

Parameters

Parameter Tags Description
account_slug Required The account identifier

Example Usage

account_slug = 'account_slug'

advocates.delete_advocates(account_slug)

Method: get_advocates

Get the list of advocates

def get_advocates(account_slug, 
                      page = 1, 
                      limit = 10, 
                      filter = nil, 
                      sort = nil); end

Parameters

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'

Example Usage

account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = advocates.get_advocates(account_slug, page, limit, filter, sort)

Method: patch_advocate

Update partial elements of an advocate.

def patch_advocate(account_slug, 
                       advocate_token, 
                       advocate_patch_form); end

Parameters

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

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'
advocate_patch_form = [AdvocatePatchForm.new]

result = advocates.patch_advocate(account_slug, advocate_token, advocate_patch_form)

Method: get_share_links

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

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'

result = advocates.get_share_links(account_slug, advocate_token)

Method: put_payment_method

Update a payment method.

def put_payment_method(account_slug, 
                           advocate_token, 
                           advocate_payment_method_id, 
                           advocate_payment_method_form); end

Parameters

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

Example Usage

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)

Method: get_payment_method

Get an advocate's payment method

def get_payment_method(account_slug, 
                           advocate_token, 
                           advocate_payment_method_id); end

Parameters

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

Example Usage

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)

Method: post_payment_method

Create a new payment method.

def post_payment_method(account_slug, 
                            advocate_token, 
                            advocate_payment_method_form); end

Parameters

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

Example Usage

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)

Method: get_bonus_redemption_method

Get bonuses redemption method.

def get_bonus_redemption_method(bonuses_redemption_method_slug); end

Parameters

Parameter Tags Description
bonuses_redemption_method_slug Required The bonus redemption method's identifier

Example Usage

bonuses_redemption_method_slug = 'bonuses_redemption_method_slug'

result = advocates.get_bonus_redemption_method(bonuses_redemption_method_slug)

Method: get_bonus_redemption_methods

Get bonuses redemption methods.

def get_bonus_redemption_methods; end

Example Usage

result = advocates.get_bonus_redemption_methods()

Method: get_currencies

Get currencies.

def get_currencies; end

Example Usage

result = advocates.get_currencies()

Method: get_currency

Get a currency.

def get_currency(code); end

Parameters

Parameter Tags Description
code Required The currency's code

Example Usage

code = 'code'

result = advocates.get_currency(code)

Method: get_payment_methods

Get the advocate's payment methods.

def get_payment_methods(account_slug, 
                            advocate_token, 
                            page = 1, 
                            limit = 10, 
                            filter = nil, 
                            sort = nil); end

Parameters

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

Example Usage

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)

Back to List of Controllers

Class: AccountsController

Get singleton instance

The singleton instance of the AccountsController class can be accessed from the API Client.

accounts = client.accounts

Method: get_account

Get an account by a given slug.

def get_account(account_slug); end

Parameters

Parameter Tags Description
account_slug Required The account identifier

Example Usage

account_slug = 'account_slug'

result = accounts.get_account(account_slug)

Method: get_accounts

Get the list of accounts.

def get_accounts(page = 1, 
                     limit = 10, 
                     filter = nil, 
                     sort = nil); end

Parameters

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

Example Usage

page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = accounts.get_accounts(page, limit, filter, sort)

Back to List of Controllers

Class: ReportsController

Get singleton instance

The singleton instance of the ReportsController class can be accessed from the API Client.

reports = client.reports

Method: get_referrals_summary_per_origin

Get referrals summary per referral origin.

def get_referrals_summary_per_origin(advocate_token); end

Parameters

Parameter Tags Description
advocate_token Required The advocate's token

Example Usage

advocate_token = 'advocate_token'

result = reports.get_referrals_summary_per_origin(advocate_token)

Method: get_bonuses_summary_per_origin

Get bonuses summary per referral origin.

def get_bonuses_summary_per_origin(advocate_token); end

Parameters

Parameter Tags Description
advocate_token Required The advocate's token

Example Usage

advocate_token = 'advocate_token'

result = reports.get_bonuses_summary_per_origin(advocate_token)

Method: get_top_advocates

Get top 10 advocates.

def get_top_advocates(account_slug = nil, 
                          campaign_slug = nil, 
                          limit = 10, 
                          from = nil, 
                          to = nil); end

Parameters

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

Example Usage

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)

Method: get_share_daily_participation

Get share daily participation.

def get_share_daily_participation(account_slug = nil, 
                                      campaign_slug = nil, 
                                      advocate_token = nil, 
                                      from = nil, 
                                      to = nil); end

Parameters

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

Example Usage

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)

Method: get_referral_daily_participation

Get referral daily participation.

def get_referral_daily_participation(account_slug = nil, 
                                         campaign_slug = nil, 
                                         advocate_token = nil, 
                                         from = nil, 
                                         to = nil); end

Parameters

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

Example Usage

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)

Method: get_click_daily_participation

Get click daily participation.

def get_click_daily_participation(account_slug = nil, 
                                      campaign_slug = nil, 
                                      advocate_token = nil, 
                                      from = nil, 
                                      to = nil); end

Parameters

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

Example Usage

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)

Method: get_bonuses_daily_given

Get bonuses daily given.

def get_bonuses_daily_given(account_slug = nil, 
                                campaign_slug = nil, 
                                advocate_token = nil, 
                                from = nil, 
                                to = nil); end

Parameters

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

Example Usage

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)

Back to List of Controllers

Class: ReferralsController

Get singleton instance

The singleton instance of the ReferralsController class can be accessed from the API Client.

referrals = client.referrals

Method: get_referral_origin

Get a referral origin by a given slug.

def get_referral_origin(referral_origin_slug); end

Parameters

Parameter Tags Description
referral_origin_slug Required The referral origin identifier

Example Usage

referral_origin_slug = 'referral_origin_slug'

result = referrals.get_referral_origin(referral_origin_slug)

Method: get_referral_origins

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

Example Usage

result = referrals.get_referral_origins()

Method: get_referral

Get a referral by a given id.

def get_referral(account_slug, 
                     advocate_token, 
                     referral_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token
referral_id Required The referral id

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_id = 'referral_id'

result = referrals.get_referral(account_slug, advocate_token, referral_id)

Method: delete_referral

Delete a referral.

def delete_referral(account_slug, 
                        advocate_token, 
                        referral_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token
referral_id Required The referral identifier

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_id = 'referral_id'

referrals.delete_referral(account_slug, advocate_token, referral_id)

Method: post_referral

Create a new referral.

def post_referral(account_slug, 
                      advocate_token, 
                      referral_form); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
advocate_token Required The advocate's token
referral_form Required The body of the request

Example Usage

account_slug = 'account_slug'
advocate_token = 'advocate_token'
referral_form = ReferralForm.new

result = referrals.post_referral(account_slug, advocate_token, referral_form)

Method: put_referral

Update a referral.

def put_referral(account_slug, 
                     advocate_token, 
                     referral_id, 
                     referral_form); end

Parameters

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

Example Usage

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)

Method: get_referrals

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

Parameters

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'

Example Usage

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)

Back to List of Controllers

Class: RedemptionRequestsController

Get singleton instance

The singleton instance of the RedemptionRequestsController class can be accessed from the API Client.

redemptionRequests = client.redemption_requests

Method: get_redemption_request_status

Get a redemption request status.

def get_redemption_request_status(redemption_request_status_slug); end

Parameters

Parameter Tags Description
redemption_request_status_slug Required The redemption request status identifier

Example Usage

redemption_request_status_slug = 'redemption_request_status_slug'

result = redemptionRequests.get_redemption_request_status(redemption_request_status_slug)

Method: get_redemption_request_statuses

Get redemption request statuses.

def get_redemption_request_statuses; end

Example Usage

result = redemptionRequests.get_redemption_request_statuses()

Method: get_redemption_request_action

Get a redemption request action.

def get_redemption_request_action(redemption_request_action_slug); end

Parameters

Parameter Tags Description
redemption_request_action_slug Required The redemption request action identifier

Example Usage

redemption_request_action_slug = 'redemption_request_action_slug'

result = redemptionRequests.get_redemption_request_action(redemption_request_action_slug)

Method: get_redemption_request_actions

Get redemption request actions.

def get_redemption_request_actions; end

Example Usage

result = redemptionRequests.get_redemption_request_actions()

Method: patch_redemption_request

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

Parameters

Parameter Tags Description
account_slug Required The account identifier
redemption_request_id Required The redemption request id

Example Usage

account_slug = 'account_slug'
redemption_request_id = 27

redemptionRequests.patch_redemption_request(account_slug, redemption_request_id)

Method: post_redemption_request

Create a redemption request.

def post_redemption_request(account_slug, 
                                redemption_request_form); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
redemption_request_form Required The body of the request

Example Usage

account_slug = 'account_slug'
redemption_request_form = RedemptionRequestForm.new

result = redemptionRequests.post_redemption_request(account_slug, redemption_request_form)

Method: get_redemption_request

Get a redemption request by a given id.

def get_redemption_request(account_slug, 
                               redemption_request_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
redemption_request_id Required The redemption request identifier

Example Usage

account_slug = 'account_slug'
redemption_request_id = 'redemption_request_id'

result = redemptionRequests.get_redemption_request(account_slug, redemption_request_id)

Method: get_redemption_requests

Get the list of redemption requests.

def get_redemption_requests(account_slug, 
                                page = 1, 
                                limit = 10, 
                                filter = nil, 
                                sort = nil); end

Parameters

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'

Example Usage

account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = redemptionRequests.get_redemption_requests(account_slug, page, limit, filter, sort)

Back to List of Controllers

Class: BonusesController

Get singleton instance

The singleton instance of the BonusesController class can be accessed from the API Client.

bonuses = client.bonuses

Method: get_bonuses

Get the list of bonuses for a given account.

def get_bonuses(account_slug, 
                    page = 1, 
                    limit = 10, 
                    filter = nil, 
                    sort = nil); end

Parameters

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'

Example Usage

account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = bonuses.get_bonuses(account_slug, page, limit, filter, sort)

Method: post_bonus

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

Parameters

Parameter Tags Description
account_slug Required The account identifier
bonuses_form Required The body of the request

Example Usage

account_slug = 'account_slug'
bonuses_form = BonusesForm.new

result = bonuses.post_bonus(account_slug, bonuses_form)

Method: get_bonus_checkup

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

Parameters

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.

Example Usage

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)

Method: post_force_bonus

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

Parameters

Parameter Tags Description
account_slug Required The account identifier
bonus_form Required The body of the request

Example Usage

account_slug = 'account_slug'
bonus_form = ForceBonusesForm.new

result = bonuses.post_force_bonus(account_slug, bonus_form)

Method: get_bonus_trace

Get a bonus request trace.

def get_bonus_trace(account_slug, 
                        trace_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
trace_id Required The trace id

Example Usage

account_slug = 'account_slug'
trace_id = 27

result = bonuses.get_bonus_trace(account_slug, trace_id)

Method: delete_bonus

Delete a bonus

def delete_bonus(account_slug, 
                     bonus_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
bonus_id Required The bonus id

Example Usage

account_slug = 'account_slug'
bonus_id = 27

bonuses.delete_bonus(account_slug, bonus_id)

Method: get_bonus

Get a bonus by a given id.

def get_bonus(account_slug, 
                  bonus_id); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
bonus_id Required The bonus id

Example Usage

account_slug = 'account_slug'
bonus_id = 27

result = bonuses.get_bonus(account_slug, bonus_id)

Method: get_bonus_traces

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

Parameters

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'

Example Usage

account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = bonuses.get_bonus_traces(account_slug, page, limit, filter, sort)

Back to List of Controllers

Class: CampaignsController

Get singleton instance

The singleton instance of the CampaignsController class can be accessed from the API Client.

campaigns = client.campaigns

Method: get_campaign

Get a campaign by a given slug.

def get_campaign(account_slug, 
                     campaign_slug); end

Parameters

Parameter Tags Description
account_slug Required The account identifier
campaign_slug Required The campaign identifier

Example Usage

account_slug = 'account_slug'
campaign_slug = 'campaign_slug'

result = campaigns.get_campaign(account_slug, campaign_slug)

Method: get_campaigns

Get the list of campaings for a given account.

def get_campaigns(account_slug, 
                      page = 1, 
                      limit = 10, 
                      filter = nil, 
                      sort = nil); end

Parameters

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'

Example Usage

account_slug = 'account_slug'
page = 1
limit = 10
filter = 'filter'
sort = 'sort'

result = campaigns.get_campaigns(account_slug, page, limit, filter, sort)

Back to List of Controllers