Sha256: c755a869c7ced9489537bbf9b634e9c1612ed2bc515f1b9f36417ddc76ae59d1

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

module Uktt
  # A Quota object for dealing with an API resource
  class Quota
    attr_accessor :config

    def initialize(opts = {})
      Uktt.configure(opts)
      @config = Uktt.config
    end

    def search(params)
      fetch "#{QUOTA}/search.json?#{URI.encode_www_form(params)}"
    end

    def config=(new_opts = {})
      merged_opts = Uktt.config.merge(new_opts)
      Uktt.configure merged_opts
      @config = Uktt.config
    end

    private

    def fetch(resource)
      Uktt::Http.new(@config[:host], 
                     @config[:version], 
                     @config[:debug])
      .retrieve(resource, 
                     @config[:return_json])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uktt-0.2.15 lib/uktt/quota.rb
uktt-0.2.14 lib/uktt/quota.rb