Class: Ipay::Rest::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ipay/rest/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#adapterObject (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

#connectionObject



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

#inspectObject



25
26
27
# File 'lib/ipay/rest/client.rb', line 25

def inspect
  "#<Ipay::Rest::Client>"
end

#transactionObject



21
22
23
# File 'lib/ipay/rest/client.rb', line 21

def transaction
  TransactionResource.new(self )
end