Class: Epayment::Intent
- Inherits:
-
Object
- Object
- Epayment::Intent
- Defined in:
- lib/epayment/intent.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(transaction:) ⇒ Intent
constructor
A new instance of Intent.
- #new_transaction ⇒ Object
Constructor Details
#initialize(transaction:) ⇒ Intent
Returns a new instance of Intent.
15 16 17 |
# File 'lib/epayment/intent.rb', line 15 def initialize transaction: @transaction = transaction end |
Instance Method Details
#execute ⇒ Object
19 20 21 |
# File 'lib/epayment/intent.rb', line 19 def execute return new_transaction end |
#new_transaction ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 |