Class: Ipay::Rest::Client
- Inherits:
-
Object
- Object
- Ipay::Rest::Client
- Defined in:
- lib/ipay/rest/client.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(adapter: Faraday.default_adapter) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #transaction ⇒ Object
Constructor Details
#initialize(adapter: Faraday.default_adapter) ⇒ Client
Returns a new instance of Client.
8 9 10 |
# File 'lib/ipay/rest/client.rb', line 8 def initialize(adapter: Faraday.default_adapter) @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/ipay/rest/client.rb', line 6 def adapter @adapter end |
Instance Method Details
#connection ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/ipay/rest/client.rb', line 12 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = Ipay::Rest::BASE_URL conn.request :url_encoded conn.response :json, content_type: "application/json" conn.adapter @adaptor end end |
#inspect ⇒ Object
25 26 27 |
# File 'lib/ipay/rest/client.rb', line 25 def inspect "#<Ipay::Rest::Client>" end |
#transaction ⇒ Object
21 22 23 |
# File 'lib/ipay/rest/client.rb', line 21 def transaction TransactionResource.new(self ) end |