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

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

Class Method Summary collapse

Class Method Details

.call(method, data) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/rpx_now/api.rb', line 10

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



20
21
22
23
24
25
26
# File 'lib/rpx_now/api.rb', line 20

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