Sha256: 8688cea613c92de425d642c11e0aa903335c2e4d6a517325a8eba5d67ad8f9b4

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

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

    # 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,
                      :query => { :key => Deadlinez.api_key },
                      :body => proxy_params,
                      :format => nil)
      response.body
    end

    def self.stats(data)
      response = get('/stats',
                     :query => {
                       :data => data,
                       :key => Deadlinez.api_key
                     })
      response['scores']['metric']
    end

    def self.verify(key = Deadlinez.api_key)
      response = get('/verify',
                     :query => {
                       :key => key
                     })
      response.body.strip == 'valid'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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