Class: Iyzipay::HttpClient

Inherits:
Object
  • Object
show all
Defined in:
lib/iyzipay/http_client.rb

Class Method Summary collapse

Class Method Details

.delete(url, headers = {}, content, &block) ⇒ Object



15
16
17
# File 'lib/iyzipay/http_client.rb', line 15

def self.delete(url, headers={}, content, &block)
  RestClient::Request.execute(:method => :delete, :url => url, :payload => content, :headers => headers, &block)
end

.get(url, header = {}) ⇒ Object



3
4
5
# File 'lib/iyzipay/http_client.rb', line 3

def self.get(url, header={})
  RestClient.get(url, header)
end

.get_even_on_error(url, header = {}) ⇒ Object

Those methods to get failed status requests’ responses



20
21
22
23
24
# File 'lib/iyzipay/http_client.rb', line 20

def self.get_even_on_error(url, header={})
  RestClient.get(url, header) do |response, request, result|
    {response: response, request: request, result: result}
  end
end

.post(url, header, content) ⇒ Object



7
8
9
# File 'lib/iyzipay/http_client.rb', line 7

def self.post(url, header, content)
  RestClient.post(url, content, header)
end

.post_even_on_error(url, header, content) ⇒ Object



26
27
28
29
30
# File 'lib/iyzipay/http_client.rb', line 26

def self.post_even_on_error(url, header, content)
  RestClient.post(url, content, header) do |response, request, result|
    {response: response, request: request, result: result}
  end
end

.put(url, header, content) ⇒ Object



11
12
13
# File 'lib/iyzipay/http_client.rb', line 11

def self.put(url, header, content)
  RestClient.put(url, content, header)
end

.put_even_on_error(url, header, content) ⇒ Object



32
33
34
35
36
# File 'lib/iyzipay/http_client.rb', line 32

def self.put_even_on_error(url, header, content)
  RestClient.put(url, content, header) do |response, request, result|
    {response: response, request: request, result: result}
  end
end