class EbanqApi::Requests

This class represents an requests functional of Ebanq REST Api.

Public Class Methods

new(client) click to toggle source

Declares an client instance.

# File lib/ebanq_api/blocks/requests.rb, line 14
def initialize(client)
  @client = client
end

Public Instance Methods

approve(request_id) click to toggle source

Approve one transfer request /api/v1/requests/approve

Attributes

  • request_id (required) - (Number)

# File lib/ebanq_api/blocks/requests.rb, line 160
def approve(request_id)
  @client.make_request :post,
                       requests_path('approve'),
                       request_id: request_id
end
create_cft(params) click to toggle source

Create CFT request /api/v1/requests/cft

Attributes

  • params - hash of params for request,

e.g. {account_from: 1, card_to: 2, amount: 5}

    • account_from (required) - Id of account (Number)

    • card_to (required) - Id of the card (Number)

    • amount (required) - (Number)

    • description - (String)

    • tan - security number (String)

# File lib/ebanq_api/blocks/requests.rb, line 101
def create_cft(params)
  create('cft', params)
end
create_owt(params) click to toggle source

Create OWT request /api/v1/requests/owt

Attributes

  • options - hash of options for request,

e.g. {perpage: 2, page: 1, sort: 'date'}

    • user - Name of the user

      • Required if request sent by administrator (String)

    • account_from (required) - Id of account (Number)

    • is_intermediary_bank (required) - (Number)

    • amount (required) - (Number)

    • currency (required) - (Number)

    • fee_type (required) - (Number)

    • description - (String)

  • tan - security number (String)

Examples

beneficiary_bank =  EbanqApi::BeneficiaryBank.new('swift', 'name', 'address','location','country','abartn')
beneficiary_customer = EbanqApi::BeneficiaryCustomer.new('name', 'address', 'iban')
additional_info = EbanqApi::AdditionalInfo.new('information_ref')
intermediary_bank =  EbanqApi::IntermediaryBank.new('swift', 'name', 'address','location','country','abartn', 'iban')

params = {
  user: 'John',
  account_from: 1,
  beneficiary_bank: beneficiary_bank,
  beneficiary_customer: beneficiary_customer,
  additional_info: additional_info,
  is_intermediary_bank: 0,
  intermediary_bank: intermediary_bank,
  amount: 1,
  currency: 1
}

client.requests.create_owt(params)
# File lib/ebanq_api/blocks/requests.rb, line 146
def create_owt(params)
  params[:beneficiary_bank] = params[:beneficiary_bank].to_hash
  params[:beneficiary_customer] = params[:beneficiary_customer].to_hash
  params[:additional_info] = params[:additional_info].to_hash
  params[:intermediary_bank] = params[:intermediary_bank].to_hash

  create('owt', params)
end
create_tba(params) click to toggle source

Create TBA request /api/v1/requests/tba

Attributes

  • params - hash of params for request,

e.g. {user: 'John', account_from: 1, account_to: 2, amount: 5}

    • user - Name of the user

Required if request sent by administrator (String)

    • account_from (required) - Id of account (Number)

    • account_to (required) - Id of account (Number)

    • amount (required) - (Number)

    • description - (String)

    • tan - security number (String)

# File lib/ebanq_api/blocks/requests.rb, line 68
def create_tba(params)
  create('tba', params)
end
create_tbu(params) click to toggle source

Create TBU request /api/v1/requests/tbu

Attributes

  • params - hash of params for request,

e.g. {user: 'John', account_from: 1, account_to: 2, amount: 5}

    • user - Name of the user

*Required if request sent by administrator (String)

    • account_from (required) - Id of account (Number)

    • account_to (required) - Id of account (Number)

    • amount (required) - (Number)

    • description - (String)

    • user_to (required) - Name of recipient user (String)

    • tan - security number (String)

# File lib/ebanq_api/blocks/requests.rb, line 86
def create_tbu(params)
  create('tbu', params)
end
list(options = {}) click to toggle source

Get a list of all transfer request /api/v1/requests/

Attributes

  • options - hash of options for request,

e.g. {sort: 'description', order: 'asc'}

    • sort - Sorting for transactions list.

Allowed values: id, date, amount, description. (String)

    • order - Order of sorting for transactions list.

Allowed values: asc, desc. (String)

    • currency - The ID of the transfer request currency (Number)

    • request_types - Type of request (Number)

    • request_status - Status of the request (Number)

    • date_from - Start date for transactions.

Format - YYYY-MM-DD (String)

    • date_to - End date for transactions. Format - YYYY-MM-DD (String)

Examples

client.requests.list(sort: 'description')
# File lib/ebanq_api/blocks/requests.rb, line 38
def list(options = {})
  @client.make_request :get, requests_path, options
end
show(id) click to toggle source

Get one transfer request /api/v1/requests/{id}

Attributes

  • id (required) - Id of the transfer request (Number)

Examples

client.requests.show(1)
# File lib/ebanq_api/blocks/requests.rb, line 51
def show(id)
  @client.make_request :get, requests_path(id)
end

Private Instance Methods

create(type, params) click to toggle source
# File lib/ebanq_api/blocks/requests.rb, line 168
def create(type, params)
  @client.make_request :post,
                       requests_path(type),
                       params
end