class PropayClient::API

Public Class Methods

endpoint() click to toggle source
# File lib/propay_client/api.rb, line 10
def self.endpoint
  PropayClient.configuration.endpoint   
end
get(path, headers: headers()) click to toggle source
# File lib/propay_client/api.rb, line 14
def self.get(path, headers: headers())
  response = Excon.get("#{endpoint()}#{path}", headers: headers)
  return JSON.parse(response.body) if response.status == 200
  return JSON.parse(response.body) if response.status == 409
  response.body
end
headers() click to toggle source
# File lib/propay_client/api.rb, line 3
def self.headers
  {
    'Content-Type' => 'application/json',
    'Authorization' => "Basic #{PropayClient.configuration.api_key}"
  }  
end
put(path, body: {}, headers: headers()) click to toggle source
# File lib/propay_client/api.rb, line 21
def self.put(path, body: {}, headers: headers())
  response = Excon.put("#{endpoint()}#{path}", body: body.to_json, headers: headers)
  return JSON.parse(response.body) if response.status == 200
  return JSON.parse(response.body) if response.status == 409
  response.body
end