Class: Cryptopay::Connection
- Inherits:
-
Object
- Object
- Cryptopay::Connection
- Defined in:
- lib/cryptopay/connection.rb
Instance Method Summary collapse
- #call(req, return_type:) ⇒ Object
-
#initialize(config) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(config) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 9 |
# File 'lib/cryptopay/connection.rb', line 5 def initialize(config) @config = config @auth = Authentication.new(api_key: config.api_key, api_secret: config.api_secret) @faraday = setup_faraday end |
Instance Method Details
#call(req, return_type:) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cryptopay/connection.rb', line 11 def call(req, return_type:) auth.sign(req) res = run_request(req) body = JSON.parse(res.body, symbolize_names: true) return_type.build_from_hash(body) end |