Class: BasisTheory::Client
- Inherits:
-
Object
- Object
- BasisTheory::Client
- Defined in:
- lib/basis_theory/client.rb
Constant Summary collapse
- BASE_URL =
'https://api.basistheory.com/'
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #applications ⇒ Object
- #atomic_banks ⇒ Object
- #connection ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter) ⇒ Client
constructor
A new instance of Client.
- #tokens ⇒ Object
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter) ⇒ Client
Returns a new instance of Client.
11 12 13 14 |
# File 'lib/basis_theory/client.rb', line 11 def initialize(api_key:, adapter: Faraday.default_adapter) @api_key = api_key @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
9 10 11 |
# File 'lib/basis_theory/client.rb', line 9 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/basis_theory/client.rb', line 9 def api_key @api_key end |
Instance Method Details
#applications ⇒ Object
16 17 18 |
# File 'lib/basis_theory/client.rb', line 16 def applications ApplicationResource.new(self) end |
#atomic_banks ⇒ Object
20 21 22 |
# File 'lib/basis_theory/client.rb', line 20 def atomic_banks AtomicBankResource.new(self) end |
#connection ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/basis_theory/client.rb', line 28 def connection @connection ||= Faraday.new(BASE_URL) do |conn| # conn.response :logger, ::Logger.new(STDOUT), body: true, bodies: { request: true, response: true } conn.headers['X-API-KEY'] = api_key conn.headers['Content-Type'] = 'application/json' conn.response :json, content_type: 'application/json' conn.adapter adapter end end |
#tokens ⇒ Object
24 25 26 |
# File 'lib/basis_theory/client.rb', line 24 def tokens TokenResource.new(self) end |