class JeraPayment::Services::Iugu::SubAccounts::Create

Public Instance Methods

call() click to toggle source
# File lib/jera_payment/services/iugu/sub_accounts/create.rb, line 6
def call
  iugu_marketplace = JeraPayment::Api::Iugu::SubAccount.create(@attributes)

  if iugu_marketplace[:errors].present?
    add_error(iugu_marketplace[:errors])
  else
    set_api_attributes(iugu_marketplace)
  end

  @resource.errors.blank?
end

Private Instance Methods

set_api_attributes(attributes) click to toggle source
# File lib/jera_payment/services/iugu/sub_accounts/create.rb, line 19
def set_api_attributes(attributes)
  @resource.assign_attributes(attributes.slice(:account_id, :live_api_token, :test_api_token, :user_token, :name))
end