Sha256: 89f1d8f004d9e8f8b984cfcaf51a7741006a1fe4fc29165cb1a1270356df6d79

Contents?: true

Size: 800 Bytes

Versions: 1

Compression:

Stored size: 800 Bytes

Contents

module Harvest
  class Base
    include HTTParty
    format :xml
    headers({'Accept' => 'text/xml'})
  
    attr_accessor :domain, :email, :password, :use_ssl
  
    def initialize(options={})
      @domain = options[:domain] ||= Harvest.domain
      @email = options[:email] ||= Harvest.email
      @password = options[:password] ||= Harvest.password
      @use_ssl = options[:use_ssl] ||= Harvest.use_ssl
      
      self.class.base_uri "#{@domain}.harvestapp.com"
      self.class.basic_auth(@email, @password)
    end
    
    def rate_limit_status
      request = Mash.new(self.class.get('/account/rate_limit_status')).request
      %w(count time_frame_limit max_calls lockout_seconds).each do |key|
        request[key] = request[key].to_i
      end
      request
    end
    
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harvestr-0.0.1 lib/harvest/base.rb