class Epayment::Intent

Public Class Methods

new(transaction: @transaction = transaction) click to toggle source
# File lib/epayment/intent.rb, line 15
def initialize transaction:
    @transaction = transaction
end

Public Instance Methods

execute() click to toggle source
# File lib/epayment/intent.rb, line 19
def execute
    return new_transaction
end
new_transaction() click to toggle source
# File lib/epayment/intent.rb, line 23
def new_transaction
    conn = Faraday.new(url: url) do |faraday|
        faraday.adapter Faraday.default_adapter
        faraday.response :json
        faraday.token_auth("#{Epayment.configuration.auth_token}")
    end
      
    response = conn.get do |req|
        req.url '/latest', :base => 'USD'
        req.params['symbols'] = 'MXN'
    end
    response.body.rates['MXN'].to_i
end