Class: Ebanx::Command::PayoutCreate

Inherits:
Command
  • Object
show all
Defined in:
lib/ebanx/command/payout_create.rb

Instance Attribute Summary

Attributes inherited from Command

#params, #request_action, #request_body, #request_method, #response_type

Instance Method Summary collapse

Methods inherited from Command

#valid?

Constructor Details

#initialize(params) ⇒ PayoutCreate

Returns a new instance of PayoutCreate.



4
5
6
7
8
9
# File 'lib/ebanx/command/payout_create.rb', line 4

def initialize(params)
  @params         = params
  @request_method = :post
  @request_action = 'payout/create'
  @response_type  = :json
end

Instance Method Details

#validateObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ebanx/command/payout_create.rb', line 11

def validate
  validate_presence :external_reference
  validate_presence :country
  validate_presence :amount
  validate_presence :currency_code
  validate_presence :payee
  validate_presence :payee, :name
  validate_presence :payee, :email
  validate_with_callback [:payee, :document], -> (value, object) {(object[:country] == 'mx' || !value.nil?) or raise ArgumentError.new("Missing argument [:payee, :document]")}
  validate_with_callback [:payee, :document_type], -> (value, object) {(object[:country] == 'mx' || !value.nil?) or raise ArgumentError.new("Missing argument [:payee, :document_type]")}
end