Sha256: 5525f7f757f3dd4665e4b6c27ebfdefdab51579a3c4fc5bd892c1efb9b6026c8

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

module Deadlinez
  class Api
    include HTTParty
    format :xml
    base_uri 'service.afterthedeadline.com'

    REQUIRED_HEADERS = {
      'Host' => 'service.afterthedeadline.com',
      'Content-Type' => 'application/x-www-form-urlencoded',
      'User-Agent' => 'AtD/0.1'
    }

    # Proxies any URL through to AtD. Useful for the TinyMCE
    # plugin.
    def self.proxy(path, params)
      proxy_params = Deadlinez::Proxy.strip_params(params)
      response = post(path,
                      :body => proxy_params,
                      :format => nil,
                      :headers => REQUIRED_HEADERS)
      response.body
    end

    def self.stats(data)
      response = post('/stats',
                     :body => {
                       :data => data
                     },
                     :headers => REQUIRED_HEADERS)
      response['scores']['metric']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deadlinez-0.1.2 lib/deadlinez/api.rb