Class: PayU::Client
Instance Method Summary collapse
- #delete(url) ⇒ Object
- #get(url) ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #post(url, params: {}) ⇒ Object
- #put(url, params: {}) ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 |
# File 'lib/pay_u/client.rb', line 6 def initialize @client ||= Faraday.new(url: PayU.configuration.api_url) do |connection| connection.request :url_encoded connection.response :logger if PayU.configuration.test? connection.adapter Faraday.default_adapter connection.basic_auth "pRRXKOl8ikMmt9u", "4Vj8eK4rloUd272L48hsrarnUA" end end |
Instance Method Details
#delete(url) ⇒ Object
37 38 39 40 41 |
# File 'lib/pay_u/client.rb', line 37 def delete(url) response = @client.delete(&perform_request(url)) response.success? end |
#get(url) ⇒ Object
16 17 18 19 20 |
# File 'lib/pay_u/client.rb', line 16 def get(url) response = @client.get(&perform_request(url)) process_response(response) end |
#post(url, params: {}) ⇒ Object
23 24 25 26 27 |
# File 'lib/pay_u/client.rb', line 23 def post(url, params: {}) response = @client.post(&perform_request_with_params(url, params)) process_response(response) end |
#put(url, params: {}) ⇒ Object
30 31 32 33 34 |
# File 'lib/pay_u/client.rb', line 30 def put(url, params: {}) response = @client.put(&perform_request_with_params(url, params)) process_response(response) end |