Sha256: f4b7cf45cd9d120ebf2985d1de1f92884c7c5471f9ccb3dcfe39072b4b2b15eb

Contents?: true

Size: 707 Bytes

Versions: 8

Compression:

Stored size: 707 Bytes

Contents

module Rentjuicer
  class Client
    
    include HTTParty
    format :json
    
    attr_accessor :api_key
    
    def initialize(api_key)
      self.api_key = api_key
      self.class.base_uri "api.rentjuice.com/#{self.api_key}"
    end
    
    def process_get(resource, params = {})
      begin
        unless params.blank?
          self.class.get(resource, :query => params)
        else
          self.class.get(resource)
        end
      rescue Timeout::Error
        {"status" => "timeout", "code" => "0", "message" => "Rentjuice API is timing out."}
      rescue Exception
        {"status" => "busted", "code" => "0", "message" => "Rentjuice API is erroring."}
      end
    end
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rentjuicer-0.8.0 lib/rentjuicer/client.rb
rentjuicer-0.7.3 lib/rentjuicer/client.rb
rentjuicer-0.7.2 lib/rentjuicer/client.rb
rentjuicer-0.7.1 lib/rentjuicer/client.rb
rentjuicer-0.6.3 lib/rentjuicer/client.rb
rentjuicer-0.6.2 lib/rentjuicer/client.rb
rentjuicer-0.6.1 lib/rentjuicer/client.rb
rentjuicer-0.6.0 lib/rentjuicer/client.rb