Class: Wepay::Client
- Inherits:
-
Object
- Object
- Wepay::Client
- Defined in:
- lib/wepay/client.rb
Defined Under Namespace
Constant Summary collapse
- DEFAULTS =
{ open_timeout: 5, timeout: 10 }
Instance Method Summary collapse
- #get(*args, &block) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #post(*args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wepay/client.rb', line 11 def initialize @connection = Faraday.new(url, ) do |builder| # Request builder.use Wepay::Middleware::CatchTimeout yield builder if block_given? # Response builder.use FaradayMiddleware::Mashify builder.use Wepay::Middleware::CheckStatus builder.use FaradayMiddleware::ParseJson builder.adapter :net_http end end |
Instance Method Details
#get(*args, &block) ⇒ Object
27 28 29 |
# File 'lib/wepay/client.rb', line 27 def get(*args, &block) make_request(:get, *args, &block) end |
#post(*args, &block) ⇒ Object
31 32 33 |
# File 'lib/wepay/client.rb', line 31 def post(*args, &block) make_request(:post, *args, &block) end |