Class: EpsRapid::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/eps-rapid/client.rb

Class Method Summary collapse

Class Method Details

.delete(path, params) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/eps-rapid/client.rb', line 37

def delete(path, params)
  uri = generate_uri(path, params)
  req = Net::HTTP::Delete.new(uri)
  test_header, customer_ip_header = additional_headers(params)

  fetch_data(uri, req, test_header, customer_ip_header)
end

.get(path, params) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/eps-rapid/client.rb', line 10

def get(path, params)
  uri = generate_uri(path, params)
  req = Net::HTTP::Get.new(uri)
  test_header, customer_ip_header = additional_headers(params)

  fetch_data(uri, req, test_header, customer_ip_header)
end

.post(path, body, params) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/eps-rapid/client.rb', line 18

def post(path, body, params)
  uri = generate_uri(path, params)
  req = Net::HTTP::Post.new(uri)
  req.body = body.to_json
  test_header, customer_ip_header = additional_headers(params)

  fetch_data(uri, req, test_header, customer_ip_header)
end

.put(path, body = {}, params) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/eps-rapid/client.rb', line 27

def put(path, body = {}, params)
  uri = generate_uri(path, params)
  req = Net::HTTP::Put.new(uri)
  req.body = body.to_json

  test_header, customer_ip_header = additional_headers(params)

  fetch_data(uri, req, test_header, customer_ip_header)
end