Class: FatSecret::Food
Class Method Summary collapse
Class Method Details
.get(food_id) ⇒ Object
31 32 33 |
# File 'lib/fat_secret/food.rb', line 31 def get(food_id) new FatSecret::Connection.get('food.get', food_id: food_id)['food'] end |
.search(search_expression, options = {}) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fat_secret/food.rb', line 18 def search(search_expression, = {}) results = Connection.get( 'foods.search', . merge({ search_expression: search_expression }).merge() ) ResultsProxy.new( results['foods']['food'].map { |f| new(f) }, results['foods']['max_results'], results['foods']['page_number'], results['foods']['total_results'] ) end |