class NDB::NutrientReport
Constants
- PERMITTED_PARAMS
Public Class Methods
base_uri()
click to toggle source
# File lib/ndb/nutrient_report.rb, line 12 def self.base_uri NDB.base_uri + "/nutrients" end
default_options()
click to toggle source
# File lib/ndb/nutrient_report.rb, line 16 def self.default_options { fq: "", max: 50, offset: 0, sort: "f", format: "JSON", subset: 0, api_key: NDB.api_key } end
retrieve(options = {})
click to toggle source
# File lib/ndb/nutrient_report.rb, line 5 def self.retrieve(options = {}) sanitized_options = NDB.sanitize_options(options, PERMITTED_PARAMS) params = NDB.params_from_hash(default_options.merge(sanitized_options)) response = Faraday.get("#{base_uri}?#{params}") JSON.parse(response.body) end