class StarkBank::BoletoHolmes

# BoletoHolmes object

When you initialize a BoletoHolmes, 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 (optional):

## Attributes (return-only):

Attributes

boleto_id[R]
created[R]
id[R]
result[R]
status[R]
tags[R]
updated[R]

Public Class Methods

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

# Create BoletoHolmes

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

## Parameters (required):

## Parameters (optional):

## Return:

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

# Retrieve a specific BoletoHolmes

Receive a single BoletoHolmes 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/boleto_holmes/boleto_holmes.rb, line 68
def self.get(id, user: nil)
  StarkBank::Utils::Rest.get_id(id: id, user: user, **resource)
end
new( boleto_id:, tags: nil, id: nil, status: nil, result: nil, created: nil, updated: nil ) click to toggle source
Calls superclass method StarkBank::Utils::Resource::new
# File lib/boleto_holmes/boleto_holmes.rb, line 28
def initialize(
  boleto_id:, tags: nil, id: nil, status: nil, result: nil, created: nil, updated: nil
)
  super(id)
  @boleto_id = boleto_id
  @tags = tags
  @status = status
  @result = result
  @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, tags: nil, ids: nil, boleto_id: nil, user: nil) click to toggle source

# Retrieve paged BoletoHolmes

Receive a list of up to 100 BoletoHolmes 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: 'solved'

  • 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']

  • boleto_id [string, default nil]: filter for holmes that investigate a specific boleto by its ID. ex: '5656565656565656'

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

## Return:

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

# Retrieve BoletoHolmes

Receive a generator of BoletoHolmes 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: 'solved'

  • 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']

  • boleto_id [string, default nil]: filter for holmes that investigate a specific boleto by its ID. ex: '5656565656565656'

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

## Return:

# File lib/boleto_holmes/boleto_holmes.rb, line 88
def self.query(limit: nil, after: nil, before: nil, status: nil, tags: nil, ids: nil, boleto_id: 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,
    tags: tags,
    ids: ids,
    boleto_id: boleto_id,
    user: user,
    **resource
  )
end
resource() click to toggle source
# File lib/boleto_holmes/boleto_holmes.rb, line 139
def self.resource
  {
    resource_name: 'BoletoHolmes',
    resource_maker: proc { |json|
      BoletoHolmes.new(
        boleto_id: json['boleto_id'],
        tags: json['tags'],
        id: json['id'],
        status: json['status'],
        result: json['result'],
        created: json['created'],
        updated: json['updated']
      )
    }
  }
end