module NDB

Constants

VERSION

Public Class Methods

api_key() click to toggle source
# File lib/ndb-ruby.rb, line 12
def self.api_key
  @api_key
end
api_key=(key) click to toggle source
# File lib/ndb-ruby.rb, line 16
def self.api_key=(key)
  @api_key = key
end
base_uri() click to toggle source
# File lib/ndb-ruby.rb, line 20
def self.base_uri
  "http://api.nal.usda.gov/ndb"
end
configure() { |self| ... } click to toggle source
# File lib/ndb-ruby.rb, line 8
def self.configure
  yield self
end
params_from_hash(hash) click to toggle source
# File lib/ndb-ruby.rb, line 28
def self.params_from_hash(hash)
  hash.map do |param|
    param_list = []
    if param.last.is_a?(Array)
      param.last.each do |p|
        param_list << "nutrients=#{p}"
      end
    else
      param_list << "#{param.first}=#{param.last}"
    end
    param_list.join("&")
  end.join("&")
end
sanitize_options(options, permitted_params) click to toggle source
# File lib/ndb-ruby.rb, line 24
def self.sanitize_options(options, permitted_params)
  options.select { |param| permitted_params.include?(param.to_s) }
end