Class: Credigy::Promise

Inherits:
Authorized show all
Defined in:
lib/credigy/promise.rb

Instance Attribute Summary collapse

Attributes inherited from Authorized

#authorization_token

Instance Method Summary collapse

Methods inherited from Authorized

#soap_header

Methods inherited from Request

#basic_config, #call, #client, #config_options, #extra_config_options, #response, #response_class, #soap_header, #wsdl

Constructor Details

#initialize(authorization_token, **params) ⇒ Promise

  • authorization_token - token de autorização

Params

  • :accounts - um array de ids de contas. Ex: [‘123’, ‘456’]

  • :installments - numero de parcelas da promessa

  • :first_installment_date - primeira data de vencimento

  • :agreement_value - valor do acordo



15
16
17
18
# File 'lib/credigy/promise.rb', line 15

def initialize(authorization_token, **params)
  @authorization_token = authorization_token
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/credigy/promise.rb', line 6

def params
  @params
end

Instance Method Details

#messageObject



24
25
26
27
28
29
30
31
# File 'lib/credigy/promise.rb', line 24

def message
  {
    'cred:Accounts' => Array.wrap(params[:accounts]).join(';'),
    'cred:TotalInstallments' => params[:installments],
    'cred:FirstInstallmentDate' => params[:first_installment_date],
    'cred:TotalAgreementAmount' => params[:agreement_value]
  }
end

#operationObject



20
21
22
# File 'lib/credigy/promise.rb', line 20

def operation
  :generate_promise
end