fat_secret 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module FatSecret
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatSecret::Base do
4
+
5
+ it { should have_attribute(:id).of_type(Integer) }
6
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatSecret::Config do
4
+
5
+ subject { FatSecret::Config.new }
6
+
7
+ it 'should have a default logger' do
8
+ subject.logger.class.should == Logger
9
+ end
10
+
11
+ it 'should have the default rest api uri' do
12
+ subject.uri.should eql('http://platform.fatsecret.com/rest/server.api')
13
+ end
14
+
15
+ it { should respond_to(:access_key) }
16
+
17
+ it { should respond_to(:consumer_key) }
18
+
19
+ it { should respond_to(:shared_secret) }
20
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatSecret::Connection do
4
+
5
+ describe '.get' do
6
+ it do
7
+ FatSecret::Connection.should respond_to(:get)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatSecret::Food do
4
+
5
+ describe '.search' do
6
+ before { configure }
7
+
8
+ subject do
9
+ VCR.use_cassette('search_for_milk', match_requests_on: [ :host ], allow_playback_repeats: true) do
10
+ FatSecret::Food.search('Milk')
11
+ end
12
+ end
13
+
14
+ it 'should get search results' do
15
+ subject.should_not be_blank
16
+ end
17
+
18
+ it 'should contain food objects' do
19
+ subject.first.class.should eql(FatSecret::Food)
20
+ end
21
+
22
+ it 'should be an array' do
23
+ subject.should be_a(Array)
24
+ end
25
+
26
+ it 'should store the total results count' do
27
+ subject.total_results.should eql(1125)
28
+ end
29
+
30
+ it 'should have a page number' do
31
+ subject.page_number.should eq(0)
32
+ end
33
+ end
34
+
35
+ describe '.get' do
36
+ before { configure }
37
+
38
+ subject do
39
+ VCR.use_cassette('get_milk', match_requests_on: [ :host ], allow_playback_repeats: true) do
40
+ FatSecret::Food.get(793)
41
+ end
42
+ end
43
+
44
+ it 'should return a food object' do
45
+ subject.should be_instance_of(FatSecret::Food)
46
+ end
47
+
48
+ it 'should populate the food name' do
49
+ subject.name.should eql('Milk')
50
+ end
51
+
52
+ it 'should populate the servings' do
53
+ subject.servings.should_not be_blank
54
+ end
55
+
56
+ it 'should use serving objects in the servings relation' do
57
+ subject.servings.first.should be_instance_of(FatSecret::Serving)
58
+ end
59
+
60
+ it 'should add the serving data to the servings' do
61
+ subject.servings.first.saturated_fat.should eql(2.965)
62
+ end
63
+ end
64
+
65
+ describe '#servings' do
66
+ before { configure }
67
+
68
+ let(:foods) do
69
+ VCR.use_cassette('search_for_milk', match_requests_on: [ :host ], allow_playback_repeats: true) do
70
+ FatSecret::Food.search('Milk')
71
+ end
72
+ end
73
+
74
+ subject do
75
+ VCR.use_cassette('get_servings_association', match_requests_on: [ :host ], allow_playback_repeats: true) do
76
+ servings = foods.first.servings
77
+ end
78
+ end
79
+
80
+ it 'should load the servings' do
81
+ subject.should_not be_blank
82
+ end
83
+ end
84
+ end
@@ -0,0 +1 @@
1
+ require 'spec_helper'
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe FatSecret do
4
+ it { should respond_to(:configure) }
5
+
6
+ describe '.configure' do
7
+ before do
8
+ FatSecret.configure do |f|
9
+ f.access_key = '1234'
10
+ f.consumer_key = 'abcd'
11
+ f.shared_secret = 'I see dead people'
12
+ f.logger = logger
13
+ end
14
+ end
15
+
16
+ let(:logger) { Logger.new($STDOUT) }
17
+
18
+ subject { FatSecret.configuration }
19
+
20
+ it 'should initialize a new config object' do
21
+ FatSecret.configuration.should be_a(FatSecret::Config)
22
+ end
23
+
24
+ it 'should set the access key' do
25
+ subject.access_key.should eql('1234')
26
+ end
27
+
28
+ it 'should set the consumer key' do
29
+ subject.consumer_key.should eql('abcd')
30
+ end
31
+
32
+ it 'should set the shared secret' do
33
+ subject.shared_secret.should eql('I see dead people')
34
+ end
35
+
36
+ it 'should set the logger' do
37
+ subject.logger.should eql(logger)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,27 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'active_attr/rspec'
9
+ require 'bundler/setup'
10
+ require 'fat_secret'
11
+ require 'rubygems'
12
+ require 'support/helpers'
13
+ require 'support/vcr'
14
+
15
+ RSpec.configure do |config|
16
+ config.treat_symbols_as_metadata_keys_with_true_values = true
17
+ config.run_all_when_everything_filtered = true
18
+ config.filter_run :focus
19
+
20
+ # Run specs in random order to surface order dependencies. If you find an
21
+ # order dependency and want to debug it, you can fix the order by providing
22
+ # the seed, which is printed after each run.
23
+ # --seed 1234
24
+ config.order = 'random'
25
+
26
+ config.include Helpers
27
+ end
@@ -0,0 +1,9 @@
1
+ module Helpers
2
+ def configure
3
+ FatSecret.configure do |c|
4
+ c.access_key = '1234'
5
+ c.consumer_key = 'abcd'
6
+ c.shared_secret = 'secret'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ require 'vcr'
2
+
3
+ VCR.configure do |c|
4
+ c.cassette_library_dir = 'spec/vcr_cassettes'
5
+ c.hook_into :fakeweb
6
+ end
@@ -0,0 +1,106 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://platform.fatsecret.com/rest/server.api?food_id=793&format=json&method=food.get&oauth_consumer_key=7ebedda1451640ecbd8db41ea22d1351&oauth_nonce=bf13ecc1c0626d5f&oauth_signature=E9zVgOaTC6x0VAfuRCWYNael9Zo%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1349949298&oauth_version=1.0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ cache-control:
20
+ - private
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.5
25
+ x-aspnet-version:
26
+ - 2.0.50727
27
+ date:
28
+ - Thu, 11 Oct 2012 09:54:51 GMT
29
+ content-length:
30
+ - '6015'
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{ "food": {"food_id": "793", "food_name": "Milk", "food_type": "Generic",
34
+ "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk",
35
+ "servings": { "serving": [ {"calcium": "28", "calories": "122", "carbohydrate":
36
+ "11.49", "cholesterol": "17", "fat": "4.88", "fiber": "0", "iron": "0", "measurement_description":
37
+ "cup", "metric_serving_amount": "244.000", "metric_serving_unit": "g", "monounsaturated_fat":
38
+ "1.301", "number_of_units": "1.000", "polyunsaturated_fat": "0.249", "potassium":
39
+ "361", "protein": "8.03", "saturated_fat": "2.965", "serving_description":
40
+ "1 cup", "serving_id": "3", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=3&portionamount=1.000",
41
+ "sodium": "100", "sugar": "12.59", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
42
+ "4", "calories": "15", "carbohydrate": "1.44", "cholesterol": "2", "fat":
43
+ "0.61", "fiber": "0", "iron": "0", "measurement_description": "fl oz", "metric_serving_amount":
44
+ "30.500", "metric_serving_unit": "g", "monounsaturated_fat": "0.163", "number_of_units":
45
+ "1.000", "polyunsaturated_fat": "0.031", "potassium": "45", "protein": "1.00",
46
+ "saturated_fat": "0.371", "serving_description": "1 fl oz", "serving_id":
47
+ "192", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=192&portionamount=1.000",
48
+ "sodium": "13", "sugar": "1.57", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
49
+ "28", "calories": "122", "carbohydrate": "11.49", "cholesterol": "17", "fat":
50
+ "4.88", "fiber": "0", "iron": "0", "measurement_description": "Quantity not
51
+ specified", "metric_serving_amount": "244.000", "metric_serving_unit": "g",
52
+ "monounsaturated_fat": "1.301", "number_of_units": "1.000", "polyunsaturated_fat":
53
+ "0.249", "potassium": "361", "protein": "8.03", "saturated_fat": "2.965",
54
+ "serving_description": "1 serving (244 g)", "serving_id": "4", "serving_url":
55
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=4&portionamount=1.000",
56
+ "sodium": "100", "sugar": "12.59", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
57
+ "0", "calories": "1", "carbohydrate": "0.12", "cholesterol": "0", "fat": "0.05",
58
+ "fiber": "0", "iron": "0", "measurement_description": "Guideline amount per
59
+ fl oz of beverage", "metric_serving_amount": "2.500", "metric_serving_unit":
60
+ "g", "monounsaturated_fat": "0.013", "number_of_units": "1.000", "polyunsaturated_fat":
61
+ "0.003", "potassium": "4", "protein": "0.08", "saturated_fat": "0.030", "serving_description":
62
+ "1 Guideline amount per fl oz beverage", "serving_id": "5", "serving_url":
63
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=5&portionamount=1.000",
64
+ "sodium": "1", "sugar": "0.13", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
65
+ "7", "calories": "30", "carbohydrate": "2.87", "cholesterol": "4", "fat":
66
+ "1.22", "fiber": "0", "iron": "0", "measurement_description": "Guideline amount
67
+ per cup of hot cereal", "metric_serving_amount": "61.000", "metric_serving_unit":
68
+ "g", "monounsaturated_fat": "0.325", "number_of_units": "1.000", "polyunsaturated_fat":
69
+ "0.062", "potassium": "90", "protein": "2.01", "saturated_fat": "0.741", "serving_description":
70
+ "1 Guideline amount per cup hot cereal", "serving_id": "6", "serving_url":
71
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=6&portionamount=1.000",
72
+ "sodium": "25", "sugar": "3.15", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
73
+ "14", "calories": "61", "carbohydrate": "5.75", "cholesterol": "9", "fat":
74
+ "2.44", "fiber": "0", "iron": "0", "measurement_description": "Guideline amount
75
+ per cup of cold cereal", "metric_serving_amount": "122.000", "metric_serving_unit":
76
+ "g", "monounsaturated_fat": "0.650", "number_of_units": "1.000", "polyunsaturated_fat":
77
+ "0.124", "potassium": "181", "protein": "4.01", "saturated_fat": "1.482",
78
+ "serving_description": "1 Guideline amount per cup cold cereal", "serving_id":
79
+ "7", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=7&portionamount=1.000",
80
+ "sodium": "50", "sugar": "6.30", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
81
+ "35", "calories": "148", "carbohydrate": "13.99", "cholesterol": "21", "fat":
82
+ "5.94", "fiber": "0", "iron": "0", "measurement_description": "soup can of
83
+ milk for modifications", "metric_serving_amount": "297.000", "metric_serving_unit":
84
+ "g", "monounsaturated_fat": "1.583", "number_of_units": "1.000", "polyunsaturated_fat":
85
+ "0.303", "potassium": "440", "protein": "9.77", "saturated_fat": "3.609",
86
+ "serving_description": "1 soup can milk for modifications", "serving_id":
87
+ "198", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=198&portionamount=1.000",
88
+ "sodium": "122", "sugar": "15.33", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
89
+ "12", "calories": "50", "carbohydrate": "4.71", "cholesterol": "7", "fat":
90
+ "2.00", "fiber": "0", "iron": "0", "measurement_description": "g", "metric_serving_amount":
91
+ "100.000", "metric_serving_unit": "g", "monounsaturated_fat": "0.533", "number_of_units":
92
+ "100.000", "polyunsaturated_fat": "0.102", "potassium": "148", "protein":
93
+ "3.29", "saturated_fat": "1.215", "serving_description": "100 g", "serving_id":
94
+ "49473", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=49473&portionamount=100.000",
95
+ "sodium": "41", "sugar": "5.16", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
96
+ "12", "calories": "52", "carbohydrate": "4.86", "cholesterol": "7", "fat":
97
+ "2.06", "fiber": "0", "iron": "0", "measurement_description": "ml", "metric_serving_amount":
98
+ "103.133", "metric_serving_unit": "g", "monounsaturated_fat": "0.550", "number_of_units":
99
+ "100.000", "polyunsaturated_fat": "0.105", "potassium": "153", "protein":
100
+ "3.39", "saturated_fat": "1.253", "serving_description": "100 ml", "serving_id":
101
+ "1136438", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=1136438&portionamount=100.000",
102
+ "sodium": "42", "sugar": "5.32", "vitamin_a": "0", "vitamin_c": "0" } ] }
103
+ }}'
104
+ http_version: '1.1'
105
+ recorded_at: Thu, 11 Oct 2012 09:54:59 GMT
106
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,106 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://platform.fatsecret.com/rest/server.api?food_id=793&format=json&method=food.get&oauth_consumer_key=7ebedda1451640ecbd8db41ea22d1351&oauth_nonce=29a81c9406bc7d1c&oauth_signature=FR8Qs5YHFr2OtXjYAhTU2GNds3Q%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1349949947&oauth_version=1.0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ accept:
11
+ - ! '*/*'
12
+ user-agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ cache-control:
20
+ - private
21
+ content-type:
22
+ - application/json; charset=utf-8
23
+ server:
24
+ - Microsoft-IIS/7.5
25
+ x-aspnet-version:
26
+ - 2.0.50727
27
+ date:
28
+ - Thu, 11 Oct 2012 10:05:40 GMT
29
+ content-length:
30
+ - '6015'
31
+ body:
32
+ encoding: US-ASCII
33
+ string: ! '{ "food": {"food_id": "793", "food_name": "Milk", "food_type": "Generic",
34
+ "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk",
35
+ "servings": { "serving": [ {"calcium": "28", "calories": "122", "carbohydrate":
36
+ "11.49", "cholesterol": "17", "fat": "4.88", "fiber": "0", "iron": "0", "measurement_description":
37
+ "cup", "metric_serving_amount": "244.000", "metric_serving_unit": "g", "monounsaturated_fat":
38
+ "1.301", "number_of_units": "1.000", "polyunsaturated_fat": "0.249", "potassium":
39
+ "361", "protein": "8.03", "saturated_fat": "2.965", "serving_description":
40
+ "1 cup", "serving_id": "3", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=3&portionamount=1.000",
41
+ "sodium": "100", "sugar": "12.59", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
42
+ "4", "calories": "15", "carbohydrate": "1.44", "cholesterol": "2", "fat":
43
+ "0.61", "fiber": "0", "iron": "0", "measurement_description": "fl oz", "metric_serving_amount":
44
+ "30.500", "metric_serving_unit": "g", "monounsaturated_fat": "0.163", "number_of_units":
45
+ "1.000", "polyunsaturated_fat": "0.031", "potassium": "45", "protein": "1.00",
46
+ "saturated_fat": "0.371", "serving_description": "1 fl oz", "serving_id":
47
+ "192", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=192&portionamount=1.000",
48
+ "sodium": "13", "sugar": "1.57", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
49
+ "28", "calories": "122", "carbohydrate": "11.49", "cholesterol": "17", "fat":
50
+ "4.88", "fiber": "0", "iron": "0", "measurement_description": "Quantity not
51
+ specified", "metric_serving_amount": "244.000", "metric_serving_unit": "g",
52
+ "monounsaturated_fat": "1.301", "number_of_units": "1.000", "polyunsaturated_fat":
53
+ "0.249", "potassium": "361", "protein": "8.03", "saturated_fat": "2.965",
54
+ "serving_description": "1 serving (244 g)", "serving_id": "4", "serving_url":
55
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=4&portionamount=1.000",
56
+ "sodium": "100", "sugar": "12.59", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
57
+ "0", "calories": "1", "carbohydrate": "0.12", "cholesterol": "0", "fat": "0.05",
58
+ "fiber": "0", "iron": "0", "measurement_description": "Guideline amount per
59
+ fl oz of beverage", "metric_serving_amount": "2.500", "metric_serving_unit":
60
+ "g", "monounsaturated_fat": "0.013", "number_of_units": "1.000", "polyunsaturated_fat":
61
+ "0.003", "potassium": "4", "protein": "0.08", "saturated_fat": "0.030", "serving_description":
62
+ "1 Guideline amount per fl oz beverage", "serving_id": "5", "serving_url":
63
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=5&portionamount=1.000",
64
+ "sodium": "1", "sugar": "0.13", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
65
+ "7", "calories": "30", "carbohydrate": "2.87", "cholesterol": "4", "fat":
66
+ "1.22", "fiber": "0", "iron": "0", "measurement_description": "Guideline amount
67
+ per cup of hot cereal", "metric_serving_amount": "61.000", "metric_serving_unit":
68
+ "g", "monounsaturated_fat": "0.325", "number_of_units": "1.000", "polyunsaturated_fat":
69
+ "0.062", "potassium": "90", "protein": "2.01", "saturated_fat": "0.741", "serving_description":
70
+ "1 Guideline amount per cup hot cereal", "serving_id": "6", "serving_url":
71
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=6&portionamount=1.000",
72
+ "sodium": "25", "sugar": "3.15", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
73
+ "14", "calories": "61", "carbohydrate": "5.75", "cholesterol": "9", "fat":
74
+ "2.44", "fiber": "0", "iron": "0", "measurement_description": "Guideline amount
75
+ per cup of cold cereal", "metric_serving_amount": "122.000", "metric_serving_unit":
76
+ "g", "monounsaturated_fat": "0.650", "number_of_units": "1.000", "polyunsaturated_fat":
77
+ "0.124", "potassium": "181", "protein": "4.01", "saturated_fat": "1.482",
78
+ "serving_description": "1 Guideline amount per cup cold cereal", "serving_id":
79
+ "7", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=7&portionamount=1.000",
80
+ "sodium": "50", "sugar": "6.30", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
81
+ "35", "calories": "148", "carbohydrate": "13.99", "cholesterol": "21", "fat":
82
+ "5.94", "fiber": "0", "iron": "0", "measurement_description": "soup can of
83
+ milk for modifications", "metric_serving_amount": "297.000", "metric_serving_unit":
84
+ "g", "monounsaturated_fat": "1.583", "number_of_units": "1.000", "polyunsaturated_fat":
85
+ "0.303", "potassium": "440", "protein": "9.77", "saturated_fat": "3.609",
86
+ "serving_description": "1 soup can milk for modifications", "serving_id":
87
+ "198", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=198&portionamount=1.000",
88
+ "sodium": "122", "sugar": "15.33", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
89
+ "12", "calories": "50", "carbohydrate": "4.71", "cholesterol": "7", "fat":
90
+ "2.00", "fiber": "0", "iron": "0", "measurement_description": "g", "metric_serving_amount":
91
+ "100.000", "metric_serving_unit": "g", "monounsaturated_fat": "0.533", "number_of_units":
92
+ "100.000", "polyunsaturated_fat": "0.102", "potassium": "148", "protein":
93
+ "3.29", "saturated_fat": "1.215", "serving_description": "100 g", "serving_id":
94
+ "49473", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=49473&portionamount=100.000",
95
+ "sodium": "41", "sugar": "5.16", "vitamin_a": "0", "vitamin_c": "0" }, {"calcium":
96
+ "12", "calories": "52", "carbohydrate": "4.86", "cholesterol": "7", "fat":
97
+ "2.06", "fiber": "0", "iron": "0", "measurement_description": "ml", "metric_serving_amount":
98
+ "103.133", "metric_serving_unit": "g", "monounsaturated_fat": "0.550", "number_of_units":
99
+ "100.000", "polyunsaturated_fat": "0.105", "potassium": "153", "protein":
100
+ "3.39", "saturated_fat": "1.253", "serving_description": "100 ml", "serving_id":
101
+ "1136438", "serving_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk?portionid=1136438&portionamount=100.000",
102
+ "sodium": "42", "sugar": "5.32", "vitamin_a": "0", "vitamin_c": "0" } ] }
103
+ }}'
104
+ http_version: '1.1'
105
+ recorded_at: Thu, 11 Oct 2012 10:05:48 GMT
106
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,189 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ # uri: http://platform.fatsecret.com/rest/server.api?format=json&max_results=50&method=foods.search&oauth_consumer_key=7ebedda1451640ecbd8db41ea22d1351&oauth_nonce=1234&oauth_signature=YEHblI2X9JWOhRgWwWDvKw%2BhoPw%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1349948152&oauth_version=1.0&page_number=0&search_expression=Milk
6
+ uri: http://platform.fatsecret.com/rest/server.api?format=json&max_results=50&method=foods.search&oauth_consumer_key=abcd&oauth_nonce=1234&oauth_signature=PqE6UMGxCF4FySgesdMDE8qNopI%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1325372400&oauth_version=1.0&page_number=0&search_expression=Milk
7
+ body:
8
+ encoding: US-ASCII
9
+ string: ''
10
+ headers:
11
+ accept:
12
+ - ! '*/*'
13
+ user-agent:
14
+ - Ruby
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: OK
19
+ headers:
20
+ cache-control:
21
+ - private
22
+ content-type:
23
+ - application/json; charset=utf-8
24
+ server:
25
+ - Microsoft-IIS/7.5
26
+ x-aspnet-version:
27
+ - 2.0.50727
28
+ date:
29
+ - Thu, 11 Oct 2012 09:35:46 GMT
30
+ content-length:
31
+ - '14621'
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ! '{ "foods": { "food": [ {"food_description": "Per 100g - Calories:
35
+ 50kcal | Fat: 2.00g | Carbs: 4.71g | Protein: 3.29g", "food_id": "793", "food_name":
36
+ "Milk", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk"
37
+ }, {"food_description": "Per 100g - Calories: 60kcal | Fat: 3.25g | Carbs:
38
+ 4.52g | Protein: 3.22g", "food_id": "794", "food_name": "Whole Milk", "food_type":
39
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-cows-fluid-whole"
40
+ }, {"food_description": "Per 100g - Calories: 42kcal | Fat: 0.97g | Carbs:
41
+ 4.99g | Protein: 3.37g", "food_id": "803", "food_name": "1% Fat Milk", "food_type":
42
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-cows-fluid-1%25-fat"
43
+ }, {"food_description": "Per 100g - Calories: 50kcal | Fat: 1.97g | Carbs:
44
+ 4.68g | Protein: 3.30g", "food_id": "800", "food_name": "2% Fat Milk", "food_type":
45
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-cows-fluid-2%25-fat"
46
+ }, {"food_description": "Per 100g - Calories: 35kcal | Fat: 0.18g | Carbs:
47
+ 4.85g | Protein: 3.41g", "food_id": "33820", "food_name": "Milk (Nonfat)",
48
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat)"
49
+ }, {"food_description": "Per 100g - Calories: 42kcal | Fat: 0.97g | Carbs:
50
+ 4.99g | Protein: 3.37g", "food_id": "303408", "food_name": "Low Fat Milk",
51
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/mik-low-fat"
52
+ }, {"food_description": "Per 100g - Calories: 50kcal | Fat: 1.97g | Carbs:
53
+ 4.68g | Protein: 3.30g", "food_id": "303410", "food_name": "Reduced Fat Milk",
54
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-reduced-fat"
55
+ }, {"food_description": "Per 100g - Calories: 52kcal | Fat: 1.92g | Carbs:
56
+ 4.93g | Protein: 4.48g", "food_id": "38329", "food_name": "Soy Milk", "food_type":
57
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/soy-milk"
58
+ }, {"food_description": "Per 100g - Calories: 76kcal | Fat: 2.10g | Carbs:
59
+ 11.55g | Protein: 3.08g", "food_id": "887", "food_name": "Chocolate Milk",
60
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-chocolate"
61
+ }, {"food_description": "Per 100g - Calories: 50kcal | Fat: 1.97g | Carbs:
62
+ 4.68g | Protein: 3.30g", "food_id": "33752", "food_name": "Milk (2% Lowfat
63
+ with Added Vitamin A)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(2%25-lowfat-with-added-vitamin-a)"
64
+ }, {"food_description": "Per 100g - Calories: 44kcal | Fat: 1.28g | Carbs:
65
+ 4.81g | Protein: 3.33g", "food_id": "799", "food_name": "Milk (Other Than
66
+ Whole, 1% or Skim)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-cows-fluid-other-than-whole-1%25-or-skim-(formerly-milk-cows-fluid-lowfat-ns-as-to-percent-fat)"
67
+ }, {"food_description": "Per 986g - Calories: 631kcal | Fat: 34.21g | Carbs:
68
+ 49.20g | Protein: 33.72g", "food_id": "819", "food_name": "Whole Dry Milk
69
+ (Reconstituted)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-dry-reconstituted-whole"
70
+ }, {"food_description": "Per 980g - Calories: 323kcal | Fat: 0.69g | Carbs:
71
+ 47.52g | Protein: 31.94g", "food_id": "821", "food_name": "Nonfat Dry Milk
72
+ (Reconstituted)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-dry-reconstituted-nonfat"
73
+ }, {"food_description": "Per 100g - Calories: 362kcal | Fat: 0.77g | Carbs:
74
+ 51.98g | Protein: 36.16g", "food_id": "33764", "food_name": "Milk (Nonfat,
75
+ Dry)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-dry)"
76
+ }, {"food_description": "Per 100g - Calories: 42kcal | Fat: 0.97g | Carbs:
77
+ 4.99g | Protein: 3.37g", "food_id": "33755", "food_name": "Milk (1% Lowfat
78
+ with Added Vitamin A)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(1%25-lowfat-with-added-vitamin-a)"
79
+ }, {"food_description": "Per 100g - Calories: 134kcal | Fat: 7.56g | Carbs:
80
+ 10.04g | Protein: 6.81g", "food_id": "33769", "food_name": "Evaporated Milk",
81
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/evaporated-milk"
82
+ }, {"food_description": "Per 100g - Calories: 78kcal | Fat: 0.20g | Carbs:
83
+ 11.35g | Protein: 7.55g", "food_id": "33770", "food_name": "Evaporated Milk
84
+ (Nonfat)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/evaporated-milk-(nonfat)"
85
+ }, {"food_description": "Per 100g - Calories: 83kcal | Fat: 3.39g | Carbs:
86
+ 10.34g | Protein: 3.17g", "food_id": "33771", "food_name": "Chocolate Milk
87
+ (Whole)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/chocolate-milk-(whole)"
88
+ }, {"food_description": "Per 100g - Calories: 63kcal | Fat: 1.00g | Carbs:
89
+ 10.44g | Protein: 3.24g", "food_id": "33773", "food_name": "Chocolate Milk
90
+ (Lowfat)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/chocolate-milk-(lowfat)"
91
+ }, {"food_description": "Per 100g - Calories: 76kcal | Fat: 1.90g | Carbs:
92
+ 12.13g | Protein: 2.99g", "food_id": "33772", "food_name": "Chocolate Milk
93
+ (Reduced Fat)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/chocolate-milk-(reduced-fat)"
94
+ }, {"food_description": "Per 100g - Calories: 69kcal | Fat: 4.14g | Carbs:
95
+ 4.45g | Protein: 3.56g", "food_id": "33775", "food_name": "Goats Milk", "food_type":
96
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/goats-milk"
97
+ }, {"food_description": "Per 100g - Calories: 40kcal | Fat: 0.88g | Carbs:
98
+ 4.79g | Protein: 3.31g", "food_id": "33761", "food_name": "Buttermilk (Lowfat,
99
+ Cultured)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/buttermilk-(lowfat-cultured)"
100
+ }, {"food_description": "Per 100g - Calories: 60kcal | Fat: 3.25g | Carbs:
101
+ 4.52g | Protein: 3.22g", "food_id": "796", "food_name": "Whole Milk (Calcium
102
+ Fortified)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-calcium-fortified-cows-fluid-whole"
103
+ }, {"food_description": "Per 100g - Calories: 60kcal | Fat: 3.25g | Carbs:
104
+ 4.52g | Protein: 3.22g", "food_id": "33750", "food_name": "Milk (Whole Milk)",
105
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(whole-milk)"
106
+ }, {"food_description": "Per 100g - Calories: 34kcal | Fat: 0.08g | Carbs:
107
+ 4.96g | Protein: 3.37g", "food_id": "33758", "food_name": "Milk (Nonfat with
108
+ Added Vitamin A)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-with-added-vitamin-a)"
109
+ }, {"food_description": "Per 100g - Calories: 56kcal | Fat: 1.98g | Carbs:
110
+ 5.49g | Protein: 3.95g", "food_id": "33754", "food_name": "Milk (2% Lowfat
111
+ with Added Vitamin A and Protein)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(2%25-lowfat-with-added-vitamin-a-and-protein)"
112
+ }, {"food_description": "Per 100g - Calories: 41kcal | Fat: 0.25g | Carbs:
113
+ 5.56g | Protein: 3.96g", "food_id": "33760", "food_name": "Milk (Nonfat with
114
+ Added Vitamin A and Protein)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-with-added-vitamin-a-and-protein)"
115
+ }, {"food_description": "Per 100g - Calories: 35kcal | Fat: 0.18g | Carbs:
116
+ 4.85g | Protein: 3.40g", "food_id": "40654", "food_name": "Milk (Fat Free
117
+ or Skim, Calcium Fortified)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(fat-free-or-skim-calcium-fortified)"
118
+ }, {"food_description": "Per 100g - Calories: 51kcal | Fat: 1.92g | Carbs:
119
+ 4.97g | Protein: 3.48g", "food_id": "33753", "food_name": "Milk (2% Lowfat
120
+ with Added Vitamin A and Nonfat Solids)", "food_type": "Generic", "food_url":
121
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(2%25-lowfat-with-added-vitamin-a-and-nonfat-solids)"
122
+ }, {"food_description": "Per 100g - Calories: 37kcal | Fat: 0.25g | Carbs:
123
+ 5.02g | Protein: 3.57g", "food_id": "33759", "food_name": "Milk (Nonfat with
124
+ Added Vitamin A and Nonfat Solids)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-with-added-vitamin-a-and-nonfat-solids)"
125
+ }, {"food_description": "Per 100g - Calories: 321kcal | Fat: 8.70g | Carbs:
126
+ 54.40g | Protein: 7.91g", "food_id": "33768", "food_name": "Canned Milk (Sweetened)",
127
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/canned-milk-(sweetened)"
128
+ }, {"food_description": "Per 100g - Calories: 77kcal | Fat: 2.33g | Carbs:
129
+ 10.63g | Protein: 3.52g", "food_id": "33774", "food_name": "Hot Cocoa Milk",
130
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/hot-cocoa-milk"
131
+ }, {"food_description": "Per 100g - Calories: 56kcal | Fat: 1.98g | Carbs:
132
+ 5.49g | Protein: 3.95g", "food_id": "33821", "food_name": "Milk (2% Lowfat
133
+ Without Added Vitamin A and Nonfat Solids)", "food_type": "Generic", "food_url":
134
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(2%25-lowfat-without-added-vitamin-a-and-nonfat-solids)"
135
+ }, {"food_description": "Per 100g - Calories: 134kcal | Fat: 7.56g | Carbs:
136
+ 10.04g | Protein: 6.81g", "food_id": "33822", "food_name": "Evaporated Milk
137
+ (with Added Vitamin A)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/evaporated-milk-(with-added-vitamin-a)"
138
+ }, {"food_description": "Per 100g - Calories: 43kcal | Fat: 0.97g | Carbs:
139
+ 4.97g | Protein: 3.48g", "food_id": "33756", "food_name": "Milk (1% Lowfat
140
+ with Added Vitamin A and Nonfat Solids)", "food_type": "Generic", "food_url":
141
+ "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(1%25-lowfat-with-added-vitamin-a-and-nonfat-solids)"
142
+ }, {"food_description": "Per 100g - Calories: 48kcal | Fat: 1.17g | Carbs:
143
+ 5.52g | Protein: 3.93g", "food_id": "33757", "food_name": "Milk (1% Lowfat
144
+ with Added Vitamin A and Protein)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(1%25-lowfat-with-added-vitamin-a-and-protein)"
145
+ }, {"food_description": "Per 100g - Calories: 362kcal | Fat: 0.77g | Carbs:
146
+ 51.98g | Protein: 36.16g", "food_id": "33823", "food_name": "Milk (Nonfat
147
+ with Added Vitamin A, Dry)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-with-added-vitamin-a-dry)"
148
+ }, {"food_description": "Per 100g - Calories: 358kcal | Fat: 0.72g | Carbs:
149
+ 52.19g | Protein: 35.10g", "food_id": "33824", "food_name": "Milk (Nonfat,
150
+ Dry, Instant)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-dry-instant)"
151
+ }, {"food_description": "Per 100g - Calories: 108kcal | Fat: 7.00g | Carbs:
152
+ 5.36g | Protein: 5.98g", "food_id": "33778", "food_name": "Sheep Milk", "food_type":
153
+ "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/sheep-milk"
154
+ }, {"food_description": "Per 100g - Calories: 61kcal | Fat: 3.46g | Carbs:
155
+ 4.46g | Protein: 3.10g", "food_id": "33762", "food_name": "Milk (Low Sodium)",
156
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(low-sodium)"
157
+ }, {"food_description": "Per 100g - Calories: 496kcal | Fat: 26.71g | Carbs:
158
+ 38.42g | Protein: 26.32g", "food_id": "33763", "food_name": "Milk (Whole Milk,
159
+ Dry)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(whole-milk-dry)"
160
+ }, {"food_description": "Per 100g - Calories: 358kcal | Fat: 0.72g | Carbs:
161
+ 52.19g | Protein: 35.10g", "food_id": "33765", "food_name": "Milk (Nonfat
162
+ with Added Vitamin A, Instant)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-with-added-vitamin-a-instant)"
163
+ }, {"food_description": "Per 100g - Calories: 354kcal | Fat: 0.20g | Carbs:
164
+ 51.80g | Protein: 35.50g", "food_id": "33766", "food_name": "Milk (Nonfat
165
+ Calcium Reduced, Dry)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/milk-(nonfat-calcium-reduced-dry)"
166
+ }, {"food_description": "Per 100g - Calories: 387kcal | Fat: 5.78g | Carbs:
167
+ 49.00g | Protein: 34.30g", "food_id": "33767", "food_name": "Buttermilk (Dried)",
168
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/buttermilk-(dried)"
169
+ }, {"food_description": "Per 100g - Calories: 78kcal | Fat: 1.90g | Carbs:
170
+ 12.13g | Protein: 2.99g", "food_id": "33861", "food_name": "Chocolate Milk
171
+ (Reduced Fat with Added Calcium)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/chocolate-milk-(reduced-fat-with-added-calcium)"
172
+ }, {"food_description": "Per 100g - Calories: 56kcal | Fat: 2.00g | Carbs:
173
+ 5.30g | Protein: 4.10g", "food_id": "40620", "food_name": "Buttermilk (Reduced
174
+ Fat, Cultured)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/usda\/buttermilk-(reduced-fat-cultured)"
175
+ }, {"food_description": "Per 266g - Calories: 170kcal | Fat: 1.20g | Carbs:
176
+ 30.65g | Protein: 9.35g", "food_id": "917", "food_name": "Chocolate Malted
177
+ Milk (with Skim Milk)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-malted-unfortified-chocolate-made-with-skim-milk"
178
+ }, {"food_description": "Per 100g - Calories: 56kcal | Fat: 0.28g | Carbs:
179
+ 10.89g | Protein: 3.42g", "food_id": "890", "food_name": "Skim Chocolate Milk",
180
+ "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-chocolate-skim-milk-based"
181
+ }, {"food_description": "Per 102g - Calories: 94kcal | Fat: 2.00g | Carbs:
182
+ 11.35g | Protein: 7.55g", "food_id": "832", "food_name": "2% Fat Evaporated
183
+ Milk (Undiluted)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-evaporated-2%25-fat-undiluted"
184
+ }, {"food_description": "Per 493g - Calories: 202kcal | Fat: 0.49g | Carbs:
185
+ 29.04g | Protein: 19.33g", "food_id": "837", "food_name": "Skim Evaporated
186
+ Milk (Diluted)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/milk-evaporated-skim-diluted"
187
+ } ], "max_results": "50", "page_number": "0", "total_results": "1125" }}'
188
+ http_version: '1.1'
189
+ recorded_at: Thu, 11 Oct 2012 09:35:53 GMT