class StarkBank::BrcodePayment

# BrcodePayment object

When you initialize a BrcodePayment, the entity will not be automatically created in the Stark Bank API. The 'create' function sends the objects to the Stark Bank API and returns the list of created objects.

## Parameters (required):

## Parameters (conditionally required):

## Parameters (optional):

## Attributes (return-only):

Attributes

amount[R]
brcode[R]
created[R]
description[R]
fee[R]
id[R]
name[R]
scheduled[R]
status[R]
tags[R]
tax_id[R]
transaction_ids[R]
type[R]
updated[R]

Public Class Methods

create(payments, user: nil) click to toggle source

# Create BrcodePayments

Send a list of BrcodePayment objects for creation in the Stark Bank API

## Parameters (required):

## Parameters (optional):

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 66
def self.create(payments, user: nil)
  StarkBank::Utils::Rest.post(entities: payments, user: user, **resource)
end
get(id, user: nil) click to toggle source

# Retrieve a specific BrcodePayment

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

## Parameters (required):

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

## Parameters (optional):

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 82
def self.get(id, user: nil)
  StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
end
new(brcode:, tax_id:, description:, amount: nil, scheduled: nil, tags: nil, id: nil, name: nil, status: nil, type: nil, transaction_ids: nil, fee: nil, updated: nil, created: nil) click to toggle source
Calls superclass method StarkBank::Utils::Resource::new
# File lib/brcode_payment/brcode_payment.rb, line 37
def initialize(brcode:, tax_id:, description:, amount: nil, scheduled: nil, tags: nil, id: nil, name: nil, status: nil, type: nil, transaction_ids: nil, fee: nil, updated: nil, created: nil)
  super(id)
  @brcode = brcode
  @tax_id = tax_id
  @description = description
  @amount = amount
  @scheduled = StarkBank::Utils::Checks.check_date_or_datetime(scheduled)
  @tags = tags
  @name = name
  @status = status
  @type = type
  @transaction_ids = transaction_ids
  @fee = fee
  @updated = StarkBank::Utils::Checks.check_datetime(updated)
  @created = StarkBank::Utils::Checks.check_datetime(created)
end
page(cursor: nil, limit: nil, after: nil, before: nil, tags: nil, ids: nil, status: nil, user: nil) click to toggle source

# Retrieve paged BrcodePayments

Receive a list of up to 100 BrcodePayment 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)

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

  • ids [list of strings, default nil]: list of strings to get specific entities by ids. ex: ['12376517623', '1928367198236']

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

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

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 166
def self.page(cursor: nil, limit: nil, after: nil, before: nil, tags: nil, ids: nil, status: 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,
    tags: tags,
    ids: ids,
    status: status,
    user: user,
    **resource
  )
end
pdf(id, user: nil) click to toggle source

# Retrieve a specific BrcodePayment pdf file

Receive a single BrcodePayment pdf file generated in the Stark Bank API by passing its id.

## Parameters (required):

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

## Parameters (optional):

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 98
def self.pdf(id, user: nil)
  StarkBank::Utils::Rest.get_content(id: id, user: user, sub_resource_name: 'pdf', **resource)
end
query(limit: nil, after: nil, before: nil, tags: nil, ids: nil, status: nil, user: nil) click to toggle source

# Retrieve BrcodePayments

Receive a generator of BrcodePayment 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)

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

  • ids [list of strings, default nil]: list of strings to get specific entities by ids. ex: ['12376517623', '1928367198236']

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

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

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 134
def self.query(limit: nil, after: nil, before: nil, tags: nil, ids: nil, status: 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,
    tags: tags,
    ids: ids,
    status: status,
    user: user,
    **resource
  )
end
resource() click to toggle source
# File lib/brcode_payment/brcode_payment.rb, line 182
def self.resource
  {
    resource_name: 'BrcodePayment',
    resource_maker: proc { |json|
      BrcodePayment.new(
        brcode: json['brcode'],
        tax_id: json['tax_id'],
        description: json['description'],
        amount: json['amount'],
        scheduled: json['scheduled'],
        tags: json['tags'],
        id: json['id'],
        name: json['name'],
        status: json['status'],
        type: json['type'],
        transaction_ids: json['transaction_ids'],
        fee: json['fee'],
        updated: json['updated'],
        created: json['created']
      )
    }
  }
end
update(id, status: nil, user: nil) click to toggle source

# Update a BrcodePayment entity

Update a BrcodePayment entity previously created in the Stark Bank API

## Parameters (required):

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

  • status [string, nil]: You may cancel the payment by passing 'canceled' in the status

## Parameters (optional):

## Return:

# File lib/brcode_payment/brcode_payment.rb, line 115
def self.update(id, status: nil, user: nil)
  StarkBank::Utils::Rest.patch_id(id: id, status: status, user: user, **resource)
end