class StarkBank::Deposit

# Deposit object

Deposits represent passive cash-in received by your account from external transfers

Attributes (return-only):

Attributes

account_number[R]
account_type[R]
amount[R]
bank_code[R]
branch_code[R]
created[R]
fee[R]
id[R]
name[R]
status[R]
tags[R]
tax_id[R]
transaction_ids[R]
type[R]
updated[R]

Public Class Methods

get(id, user: nil) click to toggle source

# Retrieve a specific Deposit

Receive a single Deposit object previously created in the Stark Bank API by passing its id

## Parameters (required):

  • id [string]: object unique id. ex: '5656565656565656'

## Parameters (optional):

## Return:

  • Deposit object with updated attributes

# File lib/deposit/deposit.rb, line 63
def self.get(id, user: nil)
  StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
end
new( id:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type:, amount:, type:, status:, tags:, fee:, transaction_ids:, created:, updated: ) click to toggle source
Calls superclass method StarkBank::Utils::Resource::new
# File lib/deposit/deposit.rb, line 30
def initialize(
  id:, name:, tax_id:, bank_code:, branch_code:, account_number:, account_type:, amount:, type:, 
  status:, tags:, fee:, transaction_ids:, created:, updated:
)
  super(id)
  @name = name
  @tax_id = tax_id
  @bank_code = bank_code
  @branch_code = branch_code
  @account_number = account_number
  @account_type = account_type
  @amount = amount
  @type = type
  @status = status
  @tags = tags
  @fee = fee
  @transaction_ids = transaction_ids
  @created = StarkBank::Utils::Checks.check_datetime(created)
  @updated = StarkBank::Utils::Checks.check_datetime(updated)
end
page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, sort: nil, tags: nil, ids: nil, user: nil) click to toggle source

# Retrieve paged Deposits

Receive a list of up to 100 Deposit objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.

## Parameters (optional):

  • cursor [string, default nil]: cursor returned on the previous page function call

  • limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35

  • after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)

  • before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)

  • status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'

  • sort [string, default '-created']: sort order considered in response. Valid options are 'created' or '-created'.

  • tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']

  • ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']

  • user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call

## Return:

  • list of Deposit objects with updated attributes and cursor to retrieve the next page of Deposit objects

# File lib/deposit/deposit.rb, line 117
def self.page(cursor: nil, limit: nil, after: nil, before: nil, status: nil, sort: nil, tags: nil, ids: nil, user: nil)
  after = StarkBank::Utils::Checks.check_date(after)
  before = StarkBank::Utils::Checks.check_date(before)
  return StarkBank::Utils::Rest.get_page(
    cursor: cursor,
    limit: limit,
    after: after,
    before: before,
    status: status,
    sort: sort,
    tags: tags,
    ids: ids,
    user: user,
    **resource
  )
end
query(limit: nil, after: nil, before: nil, status: nil, sort: nil, tags: nil, ids: nil, user: nil) click to toggle source

# Retrieve Deposits

Receive a generator of Deposit objects previously created in the Stark Bank API

## Parameters (optional):

  • limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35

  • after [Date, DateTime, Time or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)

  • before [Date, DateTime, Time or string, default nil]: date filter for objects created only before specified date. ex: Date.new(2020, 3, 10)

  • status [string, default nil]: filter for status of retrieved objects. ex: 'paid' or 'registered'

  • sort [string, default '-created']: sort order considered in response. Valid options are 'created' or '-created'.

  • tags [list of strings, default nil]: tags to filter retrieved objects. ex: ['tony', 'stark']

  • ids [list of strings, default nil]: list of ids to filter retrieved objects. ex: ['5656565656565656', '4545454545454545']

  • user [Organization/Project object]: Organization or Project object. Not necessary if StarkBank.user was set before function call

## Return:

  • generator of Deposit objects with updated attributes

# File lib/deposit/deposit.rb, line 83
def self.query(limit: nil, after: nil, before: nil, status: nil, sort: nil, tags: nil, ids: nil, user: nil)
  after = StarkBank::Utils::Checks.check_date(after)
  before = StarkBank::Utils::Checks.check_date(before)
  StarkBank::Utils::Rest.get_stream(
    limit: limit,
    after: after,
    before: before,
    status: status,
    sort: sort,
    tags: tags,
    ids: ids,
    user: user,
    **resource
  )
end
resource() click to toggle source
# File lib/deposit/deposit.rb, line 134
def self.resource
  {
    resource_name: 'Deposit',
    resource_maker: proc { |json|
      Deposit.new(
        id: json['id'],
        name: json['name'],
        tax_id: json['tax_id'],
        bank_code: json['bank_code'],
        branch_code: json['branch_code'],
        account_number: json['account_number'],
        account_type: json['account_type'],
        amount: json['amount'],
        type: json['type'],
        status: json['status'],
        tags: json['tags'],
        fee: json['fee'],
        transaction_ids: json['transaction_ids'],
        created: json['created'],
        updated: json['updated']
      )
    }
  }
end