Class: StarkInfra::IssuingWithdrawal
- Inherits:
-
StarkCore::Utils::Resource
- Object
- StarkCore::Utils::Resource
- StarkInfra::IssuingWithdrawal
- Defined in:
- lib/issuingwithdrawal/issuingwithdrawal.rb
Overview
# IssuingWithdrawal object
The IssuingWithdrawal objects created in your Workspace return cash from your Issuing balance to your Banking balance.
## Parameters (required):
-
amount [integer]: IssuingWithdrawal value in cents. Minimum = 0 (any value will be accepted). ex: 1234 (= R$ 12.34)
-
external_id [string] IssuingWithdrawal external ID. ex: ‘12345’
-
description [string]: IssuingWithdrawal description. ex: ‘sending money back’
## Parameters (optional):
-
tags [list of strings, default nil]: list of strings for tagging. ex: [‘tony’, ‘stark’]
## Attributes (return-only):
-
id [string]: unique id returned when IssuingWithdrawal is created. ex: ‘5656565656565656’
-
transaction_id [string]: Stark Bank ledger transaction ids linked to this IssuingWithdrawal
-
issuing_transaction_id [string]: issuing ledger transaction ids linked to this IssuingWithdrawal
-
updated [DateTime]: latest update datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
-
created [DateTime]: creation datetime for the IssuingWithdrawal. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#external_id ⇒ Object
readonly
Returns the value of attribute external_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#issuing_transaction_id ⇒ Object
readonly
Returns the value of attribute issuing_transaction_id.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
-
#updated ⇒ Object
readonly
Returns the value of attribute updated.
Class Method Summary collapse
-
.create(withdrawal, user: nil) ⇒ Object
# Create an IssuingWithdrawal.
-
.get(id, user: nil) ⇒ Object
# Retrieve a specific IssuingWithdrawal.
-
.page(cursor: nil, limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) ⇒ Object
# Retrieve paged IssuingWithdrawals.
-
.query(limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) ⇒ Object
# Retrieve IssuingWithdrawals.
- .resource ⇒ Object
Instance Method Summary collapse
-
#initialize(amount:, external_id:, description:, tags: nil, id: nil, transaction_id: nil, issuing_transaction_id: nil, updated: nil, created: nil) ⇒ IssuingWithdrawal
constructor
A new instance of IssuingWithdrawal.
Constructor Details
#initialize(amount:, external_id:, description:, tags: nil, id: nil, transaction_id: nil, issuing_transaction_id: nil, updated: nil, created: nil) ⇒ IssuingWithdrawal
Returns a new instance of IssuingWithdrawal.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 27 def initialize( amount:, external_id:, description:, tags: nil, id: nil, transaction_id: nil, issuing_transaction_id: nil, updated: nil, created: nil ) super(id) @amount = amount @external_id = external_id @description = description = @transaction_id = transaction_id @issuing_transaction_id = issuing_transaction_id @updated = StarkCore::Utils::Checks.check_datetime(updated) @created = StarkCore::Utils::Checks.check_datetime(created) end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def amount @amount end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def created @created end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def description @description end |
#external_id ⇒ Object (readonly)
Returns the value of attribute external_id.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def external_id @external_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def id @id end |
#issuing_transaction_id ⇒ Object (readonly)
Returns the value of attribute issuing_transaction_id.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def issuing_transaction_id @issuing_transaction_id end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def transaction_id @transaction_id end |
#updated ⇒ Object (readonly)
Returns the value of attribute updated.
26 27 28 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 26 def updated @updated end |
Class Method Details
.create(withdrawal, user: nil) ⇒ Object
# Create an IssuingWithdrawal
Send a single IssuingWithdrawal object for creation in the Stark Infra API
## Parameters (required):
-
withdrawal [IssuingWithdrawal object]: IssuingWithdrawal object to be created in the API.
## Parameters (optional):
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
IssuingWithdrawal object with updated attributes
54 55 56 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 54 def self.create(withdrawal, user: nil) StarkInfra::Utils::Rest.post_single(entity: withdrawal, user: user, **resource) end |
.get(id, user: nil) ⇒ Object
# Retrieve a specific IssuingWithdrawal
Receive a single IssuingWithdrawal object previously created in the Stark Infra API by its id
## Parameters (required):
-
id [string]: object unique id. ex: ‘5656565656565656’
## Parameters (optional):
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
IssuingWithdrawal object with updated attributes
70 71 72 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 70 def self.get(id, user: nil) StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource) end |
.page(cursor: nil, limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) ⇒ Object
# Retrieve paged IssuingWithdrawals
Receive a list of up to 100 IssuingWithdrawal objects previously created in the Stark Infra 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 100]: maximum number of objects to be retrieved. Max = 100. ex: 35
-
after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
-
before [Date 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’]
-
external_ids [list of strings, default nil]: external IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
list of IssuingWithdrawal objects with updated attributes
-
cursor to retrieve the next page of IssuingWithdrawal objects
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 119 def self.page(cursor: nil, limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) after = StarkCore::Utils::Checks.check_date(after) before = StarkCore::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_page( cursor: cursor, limit: limit, external_ids: external_ids, after: after, before: before, tags: , user: user, **resource ) end |
.query(limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) ⇒ Object
# Retrieve IssuingWithdrawals
Receive a generator of IssuingWithdrawal objects previously created in the Stark Infra API
## Parameters (optional):
-
limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
-
after [Date or string, default nil]: date filter for objects created only after specified date. ex: Date.new(2020, 3, 10)
-
before [Date 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’]
-
external_ids [list of strings, default nil]: external IDs. ex: [‘5656565656565656’, ‘4545454545454545’]
-
user [Organization/Project object, default nil]: Organization or Project object. Not necessary if starkinfra.user was set before function call
## Return:
-
generator of IssuingWithdrawal objects with updated attributes
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 88 def self.query(limit: nil, external_ids: nil, after: nil, before: nil, tags: nil, user: nil) after = StarkCore::Utils::Checks.check_date(after) before = StarkCore::Utils::Checks.check_date(before) StarkInfra::Utils::Rest.get_stream( limit: limit, external_ids: external_ids, after: after, before: before, tags: , user: user, **resource ) end |
.resource ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/issuingwithdrawal/issuingwithdrawal.rb', line 134 def self.resource { resource_name: 'IssuingWithdrawal', resource_maker: proc { |json| IssuingWithdrawal.new( id: json['id'], amount: json['amount'], external_id: json['external_id'], description: json['description'], tags: json['tags'], transaction_id: json['transaction_id'], issuing_transaction_id: json['issuing_transaction_id'], updated: json['updated'], created: json['created'] ) } } end |