Class: RPXNow::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/rpx_now/api.rb

Overview

low-level interaction with rpxnow.com api

  • send requests

  • parse response

  • handle server errors

Constant Summary collapse

SSL_CERT =
File.join(File.dirname(__FILE__), '..', '..', 'certs', 'ssl_cert.pem')

Class Method Summary collapse

Class Method Details

.call(method, data) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/rpx_now/api.rb', line 13

def self.call(method, data)
  data = data.dup
  version = RPXNow.extract_version(data)
  data.delete(:api_version)

  path = "/api/v#{version}/#{method}"
  response = request(path, {:apiKey => RPXNow.api_key}.merge(data))
  parse_response(response)
end

.host(subdomain = nil) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/rpx_now/api.rb', line 23

def self.host(subdomain=nil)
  if subdomain
    "https://#{subdomain}.#{RPXNow.domain}"
  else
    "https://#{RPXNow.domain}"
  end
end