Module: Unit::Reward

Defined in:
lib/unit/models/reward/reward.rb,
lib/unit/models/reward/get_request.rb,
lib/unit/models/reward/list_reward_params.rb,
lib/unit/models/reward/create_reward_request.rb

Defined Under Namespace

Classes: CreateRewardRequest, GetRequest, ListRewardParams

Constant Summary collapse

REWARD_LIMIT =
100
REWARD_OFFSET =
0

Class Method Summary collapse

Class Method Details

.create_reward(receiving_account_id:, amount:, description:, tags:, idempotency_key:, funding_account_id: nil, rewarded_transaction: nil) ⇒ Object

Create a reward request

Parameters:

  • receiving_account_id (String)
  • amount (Integer)
  • description (String)
  • tags (Hash)
  • idempotency_key (String)
  • funding_account_id (String) (defaults to: nil)
    • optional

  • rewarded_transaction_id (String)
    • optional

See Also:



29
30
31
32
# File 'lib/unit/models/reward/reward.rb', line 29

def create_reward(receiving_account_id:, amount:, description:, tags:, idempotency_key:, funding_account_id: nil, rewarded_transaction: nil)
  request = CreateRewardRequest.new(, amount, description, tags, idempotency_key, , rewarded_transaction)
  Resource::RewardResource.create_reward(request)
end

.get_reward(reward_id:, include: nil) ⇒ Object

Get a reward by id

Parameters:

  • reward_id (String)
  • include (Array<String>) (defaults to: nil)
    • optional

See Also:



15
16
17
18
# File 'lib/unit/models/reward/reward.rb', line 15

def get_reward(reward_id:, include: nil)
  request = GetRequest.new(reward_id, include)
  Resource::RewardResource.get_reward(request)
end

.list_rewards(limit: REWARD_LIMIT, offset: REWARD_OFFSET, transaction_id: nil, rewarded_transaction_id: nil, receiving_account_id: nil, customer_id: nil, card_id: nil, status: nil, since: nil, until_: nil, tags: nil, sort: nil, include: nil) ⇒ Object

List reward params request

Parameters:

  • limit (Integer) (defaults to: REWARD_LIMIT)
    • optional

  • offset (Integer) (defaults to: REWARD_OFFSET)
    • optional

  • transaction_id (String) (defaults to: nil)
    • optional

  • rewarded_transaction_id (String) (defaults to: nil)
    • optional

  • receiving_account_id (String) (defaults to: nil)
    • optional

  • customer_id (String) (defaults to: nil)
    • optional

  • card_id (String) (defaults to: nil)
    • optional

  • status (Array<String>) (defaults to: nil)
    • optional

  • since (String) (defaults to: nil)
    • optional

  • until_ (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • sort (String) (defaults to: nil)
    • optional

  • include (Array<String>) (defaults to: nil)
    • optional

See Also:



49
50
51
52
# File 'lib/unit/models/reward/reward.rb', line 49

def list_rewards(limit: REWARD_LIMIT, offset: REWARD_OFFSET, transaction_id: nil, rewarded_transaction_id: nil, receiving_account_id: nil, customer_id: nil, card_id: nil, status: nil, since: nil, until_: nil, tags: nil, sort: nil, include: nil)
  request = ListRewardParams.new(limit, offset, transaction_id, rewarded_transaction_id, , customer_id, card_id, status, since, until_, tags, sort, include)
  Resource::RewardResource.list_rewards(request)
end