yummly 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/yummly/configuration.rb +2 -2
- data/lib/yummly/connection.rb +3 -1
- data/lib/yummly/version.rb +1 -1
- data/lib/yummly.rb +1 -0
- data/spec/configuration_spec.rb +8 -0
- data/spec/connection_spec.rb +37 -0
- data/spec/fixtures/get_recipe.json +211 -0
- data/spec/fixtures/{search_response.txt → search_response.json} +2 -2
- data/spec/spec_helper.rb +1 -2
- data/spec/support/mock_http_adapter.rb +27 -0
- data/spec/url_builder_spec.rb +57 -0
- data/spec/yummly_spec.rb +2 -6
- data/yummly.gemspec +0 -1
- metadata +11 -19
- data/spec/url_mocks.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c539e8304b8fe711901718d2b642daa7656371b4
|
4
|
+
data.tar.gz: 40c0a00eab72d42cbf1810d5968de82fb8e4199a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5afcf72c428be79cf1c8fa3d455114f2e8325d5ae2a73fe661139680da7ba0c361933791f2c9976a83b95e3038e9250fa105f42b6f03477c7e3bd782f0f698
|
7
|
+
data.tar.gz: 492406d015d80b610487cfd4cf160a54e4aa388822d114ed3e21f8a35093304d9fc5b03c40409e9a88777a569e73175d1f7da8f01e1f980ec69249690dac0d19
|
data/README.md
CHANGED
@@ -38,10 +38,12 @@ Once configured, you have access to two API calls:
|
|
38
38
|
|
39
39
|
#### Search
|
40
40
|
|
41
|
-
The search command returns a Yummly::SearchResult object, which is a
|
41
|
+
The search command returns a Yummly::SearchResult object, which is a custom Enumerable collection of Recipe objects:
|
42
42
|
|
43
43
|
result = Yummly.search('Onion soup')
|
44
|
-
result.total # returns
|
44
|
+
result.total # returns 43350
|
45
|
+
result.size # returns 10
|
46
|
+
result.collect { |recipe| recipe.name }
|
45
47
|
|
46
48
|
#### Find
|
47
49
|
|
data/lib/yummly/configuration.rb
CHANGED
@@ -19,12 +19,12 @@ module Yummly
|
|
19
19
|
attr_accessor :app_key,
|
20
20
|
:app_id,
|
21
21
|
:use_ssl,
|
22
|
-
:
|
22
|
+
:http_adapter
|
23
23
|
|
24
24
|
# Creates a configuration object, defaulting use_ssl to false.
|
25
25
|
def initialize
|
26
26
|
@use_ssl = false
|
27
|
-
@
|
27
|
+
@http_adapter = Yummly::FaradayAdapter
|
28
28
|
end
|
29
29
|
|
30
30
|
# Returns true if API calls to Yummly should use SSL.
|
data/lib/yummly/connection.rb
CHANGED
@@ -16,7 +16,7 @@ module Yummly
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def adapter
|
19
|
-
|
19
|
+
Yummly.configuration.http_adapter
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_response(response)
|
@@ -29,6 +29,8 @@ module Yummly
|
|
29
29
|
JSON.parse(response.body)
|
30
30
|
when 501 then
|
31
31
|
raise Yummly::NotImplementedError, response.body
|
32
|
+
when 500 then
|
33
|
+
raise Yummly::InternalServerError, "An internal error on the Yummly servers was encountered: #{response.body}"
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
data/lib/yummly/version.rb
CHANGED
data/lib/yummly.rb
CHANGED
data/spec/configuration_spec.rb
CHANGED
@@ -6,6 +6,14 @@ describe Yummly::Configuration do
|
|
6
6
|
specify { subject.should respond_to(:app_key) }
|
7
7
|
specify { subject.should respond_to(:app_id) }
|
8
8
|
|
9
|
+
describe "http_adapter" do
|
10
|
+
specify { subject.http_adapter.should == Yummly::FaradayAdapter }
|
11
|
+
context "when set" do
|
12
|
+
before { subject.http_adapter = String }
|
13
|
+
specify {subject.http_adapter.should == String}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
9
17
|
describe "#use_ssl?" do
|
10
18
|
specify { subject.use_ssl?.should be_false }
|
11
19
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Yummly::Connection do
|
4
|
+
|
5
|
+
let(:app_id) { "123456" }
|
6
|
+
let(:app_key) { "ABCDEFG123456" }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Yummly.configure do |config|
|
10
|
+
config.app_id = app_id
|
11
|
+
config.app_key = app_key
|
12
|
+
config.http_adapter = MockHttpAdapter
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "get" do
|
17
|
+
it "parses a successful response" do
|
18
|
+
response = Yummly::Connection.get("recipe/French-Onion-Soup-The-Pioneer-Woman-Cooks-_-Ree-Drummond-41364")
|
19
|
+
response.should be_a(Hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "returns nil when a 404 is encountered" do
|
23
|
+
response = Yummly::Connection.get("recipe/missing-recipe-1234")
|
24
|
+
response.should be_nil
|
25
|
+
end
|
26
|
+
|
27
|
+
it "raises a permission exception when access is denied" do
|
28
|
+
expect { Yummly::Connection.get("recipe/permission-denied") }.to raise_error(Yummly::PermissionError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises an exception when an internal error occurs" do
|
32
|
+
expect { Yummly::Connection.get("recipe/internal-error") }.to raise_error(Yummly::InternalServerError)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
{
|
2
|
+
"attribution": {
|
3
|
+
"html": "<a href='http://www.yummly.com/recipe/Hot-Turkey-Salad-Sandwiches-Allrecipes'>Hot Turkey Salad Sandwiches recipe</a> information powered by <img src='http://static.yummly.com/api-logo.png'/>",
|
4
|
+
"url": "http://www.yummly.com/recipe/Hot-Turkey-Salad-Sandwiches-Allrecipes",
|
5
|
+
"text": "Hot Turkey Salad Sandwiches recipes: information powered by Yummly",
|
6
|
+
"logo": "http://static.yummly.com/api-logo.png"
|
7
|
+
},
|
8
|
+
"ingredientLines": [
|
9
|
+
"2 cups diced cooked turkey",
|
10
|
+
"2 celery ribs, diced",
|
11
|
+
"1 small onion, diced",
|
12
|
+
"2 hard-cooked eggs, chopped",
|
13
|
+
"3/4 cup mayonnaise",
|
14
|
+
"1/2 teaspoon salt",
|
15
|
+
"1/4 teaspoon pepper",
|
16
|
+
"6 hamburger buns, split"
|
17
|
+
],
|
18
|
+
"flavors": {
|
19
|
+
"Salty": 0.004261637106537819,
|
20
|
+
"Meaty": 0.0019220244139432907,
|
21
|
+
"Piquant": 0,
|
22
|
+
"Bitter": 0.006931612268090248,
|
23
|
+
"Sour": 0.009972159750759602,
|
24
|
+
"Sweet": 0.0032512755133211613
|
25
|
+
},
|
26
|
+
"nutritionEstimates": [
|
27
|
+
{
|
28
|
+
"attribute": "ENERC_KCAL",
|
29
|
+
"description": "Energy",
|
30
|
+
"value": 317.4,
|
31
|
+
"unit": {
|
32
|
+
"name": "calorie",
|
33
|
+
"abbreviation": "kcal",
|
34
|
+
"plural": "calories",
|
35
|
+
"pluralAbbreviation": "kcal"
|
36
|
+
}
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"attribute": "FAT",
|
40
|
+
"description": "Total lipid (fat)",
|
41
|
+
"value": 13.97,
|
42
|
+
"unit": {
|
43
|
+
"name": "gram",
|
44
|
+
"abbreviation": "g",
|
45
|
+
"plural": "grams",
|
46
|
+
"pluralAbbreviation": "grams"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"attribute": "FASAT",
|
51
|
+
"description": "Fatty acids, total saturated",
|
52
|
+
"value": 2.7,
|
53
|
+
"unit": {
|
54
|
+
"name": "gram",
|
55
|
+
"abbreviation": "g",
|
56
|
+
"plural": "grams",
|
57
|
+
"pluralAbbreviation": "grams"
|
58
|
+
}
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"attribute": "CHOLE",
|
62
|
+
"description": "Cholesterol",
|
63
|
+
"value": 0.11,
|
64
|
+
"unit": {
|
65
|
+
"name": "gram",
|
66
|
+
"abbreviation": "g",
|
67
|
+
"plural": "grams",
|
68
|
+
"pluralAbbreviation": "grams"
|
69
|
+
}
|
70
|
+
},
|
71
|
+
{
|
72
|
+
"attribute": "NA",
|
73
|
+
"description": "Sodium, Na",
|
74
|
+
"value": 0.66,
|
75
|
+
"unit": {
|
76
|
+
"name": "gram",
|
77
|
+
"abbreviation": "g",
|
78
|
+
"plural": "grams",
|
79
|
+
"pluralAbbreviation": "grams"
|
80
|
+
}
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"attribute": "K",
|
84
|
+
"description": "Potassium, K",
|
85
|
+
"value": 0.2,
|
86
|
+
"unit": {
|
87
|
+
"name": "gram",
|
88
|
+
"abbreviation": "g",
|
89
|
+
"plural": "grams",
|
90
|
+
"pluralAbbreviation": "grams"
|
91
|
+
}
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"attribute": "CHOCDF",
|
95
|
+
"description": "Carbohydrate, by difference",
|
96
|
+
"value": 29.92,
|
97
|
+
"unit": {
|
98
|
+
"name": "gram",
|
99
|
+
"abbreviation": "g",
|
100
|
+
"plural": "grams",
|
101
|
+
"pluralAbbreviation": "grams"
|
102
|
+
}
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"attribute": "FIBTG",
|
106
|
+
"description": "Fiber, total dietary",
|
107
|
+
"value": 1.3,
|
108
|
+
"unit": {
|
109
|
+
"name": "gram",
|
110
|
+
"abbreviation": "g",
|
111
|
+
"plural": "grams",
|
112
|
+
"pluralAbbreviation": "grams"
|
113
|
+
}
|
114
|
+
},
|
115
|
+
{
|
116
|
+
"attribute": "SUGAR",
|
117
|
+
"description": "Sugars, total",
|
118
|
+
"value": 5.25,
|
119
|
+
"unit": {
|
120
|
+
"name": "gram",
|
121
|
+
"abbreviation": "g",
|
122
|
+
"plural": "grams",
|
123
|
+
"pluralAbbreviation": "grams"
|
124
|
+
}
|
125
|
+
},
|
126
|
+
{
|
127
|
+
"attribute": "PROCNT",
|
128
|
+
"description": "Protein",
|
129
|
+
"value": 17.6,
|
130
|
+
"unit": {
|
131
|
+
"name": "gram",
|
132
|
+
"abbreviation": "g",
|
133
|
+
"plural": "grams",
|
134
|
+
"pluralAbbreviation": "grams"
|
135
|
+
}
|
136
|
+
},
|
137
|
+
{
|
138
|
+
"attribute": "VITA_IU",
|
139
|
+
"description": "Vitamin A, IU",
|
140
|
+
"value": 159.13,
|
141
|
+
"unit": {
|
142
|
+
"name": "IU",
|
143
|
+
"abbreviation": "IU",
|
144
|
+
"plural": "IU",
|
145
|
+
"pluralAbbreviation": "IU"
|
146
|
+
}
|
147
|
+
},
|
148
|
+
{
|
149
|
+
"attribute": "VITC",
|
150
|
+
"description": "Vitamin C, total ascorbic acid",
|
151
|
+
"value": 0,
|
152
|
+
"unit": {
|
153
|
+
"name": "gram",
|
154
|
+
"abbreviation": "g",
|
155
|
+
"plural": "grams",
|
156
|
+
"pluralAbbreviation": "grams"
|
157
|
+
}
|
158
|
+
},
|
159
|
+
{
|
160
|
+
"attribute": "CA",
|
161
|
+
"description": "Calcium, Ca",
|
162
|
+
"value": 0.08,
|
163
|
+
"unit": {
|
164
|
+
"name": "gram",
|
165
|
+
"abbreviation": "g",
|
166
|
+
"plural": "grams",
|
167
|
+
"pluralAbbreviation": "grams"
|
168
|
+
}
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"attribute": "FE",
|
172
|
+
"description": "Iron, Fe",
|
173
|
+
"value": 0,
|
174
|
+
"unit": {
|
175
|
+
"name": "gram",
|
176
|
+
"abbreviation": "g",
|
177
|
+
"plural": "grams",
|
178
|
+
"pluralAbbreviation": "grams"
|
179
|
+
}
|
180
|
+
}
|
181
|
+
],
|
182
|
+
"images": [
|
183
|
+
{
|
184
|
+
"hostedLargeUrl": "http://i2.yummly.com/Hot-Turkey-Salad-Sandwiches-Allrecipes.l.png",
|
185
|
+
"hostedSmallUrl": "http://i2.yummly.com/Hot-Turkey-Salad-Sandwiches-Allrecipes.s.png"
|
186
|
+
}
|
187
|
+
],
|
188
|
+
"name": "Hot Turkey Salad Sandwiches",
|
189
|
+
"yield": "6 servings",
|
190
|
+
"totalTime": "30 Min",
|
191
|
+
"attributes": {
|
192
|
+
"holiday": [
|
193
|
+
"Christmas",
|
194
|
+
"Thanksgiving"
|
195
|
+
],
|
196
|
+
"cuisine": [
|
197
|
+
"Italian",
|
198
|
+
"Soul food",
|
199
|
+
"American"
|
200
|
+
]
|
201
|
+
},
|
202
|
+
"totalTimeInSeconds": 1800,
|
203
|
+
"rating": 4.44,
|
204
|
+
"numberOfServings": 6,
|
205
|
+
"source": {
|
206
|
+
"sourceRecipeUrl": "http://allrecipes.com/Recipe/hot-turkey-salad-sandwiches/detail.aspx",
|
207
|
+
"sourceSiteUrl": "http://www.allrecipes.com",
|
208
|
+
"sourceDisplayName": "AllRecipes"
|
209
|
+
},
|
210
|
+
"id": "Hot-Turkey-Salad-Sandwiches-Allrecipes"
|
211
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"attribution": {
|
3
|
-
"html": "
|
3
|
+
"html": "<a href='http://www.yummly.com/recipes/soup'>soup recipes</a> search powered by <img src=''/>",
|
4
4
|
"url": "http://www.yummly.com/recipes/soup",
|
5
5
|
"text": "soup recipes: search powered by Yummly",
|
6
6
|
"logo": ""
|
@@ -1183,7 +1183,7 @@
|
|
1183
1183
|
"salt",
|
1184
1184
|
"coriander root"
|
1185
1185
|
],
|
1186
|
-
"recipeName": "Hot &
|
1186
|
+
"recipeName": "Hot & Sour Tom Yum Soup"
|
1187
1187
|
},
|
1188
1188
|
{
|
1189
1189
|
"attributes": {
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'bundler/setup'
|
2
|
-
require 'webmock/rspec'
|
3
|
-
require "url_mocks"
|
4
2
|
require 'yummly'
|
3
|
+
require 'support/mock_http_adapter'
|
5
4
|
|
6
5
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
7
6
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class MockHttpAdapter
|
2
|
+
|
3
|
+
def self.connection(url = nil)
|
4
|
+
Faraday.new(:url => url) do |faraday|
|
5
|
+
faraday.adapter :test, self.stubs
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.stubs
|
10
|
+
Faraday::Adapter::Test::Stubs.new do |stub|
|
11
|
+
stub.get(uri('recipe/French-Onion-Soup-The-Pioneer-Woman-Cooks-_-Ree-Drummond-41364')) {[ 200, {}, response("get_recipe.json") ]}
|
12
|
+
stub.get(uri('recipe/missing-recipe-1234')) {[ 404, {}, nil ]}
|
13
|
+
stub.get(uri('recipe/permission-denied')) {[ 409, {}, "Permission denied. Please check your app id and app key and try again later." ]}
|
14
|
+
stub.get(uri('recipe/internal-error')) {[ 500, {}, "BOOM!" ]}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.uri(path_fragment)
|
19
|
+
"/#{Yummly::API_VERSION}/api/#{path_fragment}?_app_id=#{Yummly.configuration.app_id}&_app_key=#{Yummly.configuration.app_key}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.response(name)
|
23
|
+
path = File.expand_path("spec/fixtures/#{name}")
|
24
|
+
File.open(path, 'rb').read
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Yummly::UrlBuilder do
|
4
|
+
|
5
|
+
let(:ssl) { false }
|
6
|
+
let(:app_id) { "123456" }
|
7
|
+
let(:app_key) { "ABCDEFG123456" }
|
8
|
+
|
9
|
+
before do
|
10
|
+
Yummly.configure do |config|
|
11
|
+
config.use_ssl = ssl
|
12
|
+
config.app_id = app_id
|
13
|
+
config.app_key = app_key
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".domain" do
|
18
|
+
context "when ssl is not enabled" do
|
19
|
+
specify { Yummly::UrlBuilder.domain.should == "http://api.yummly.com" }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when ssl is enabled" do
|
23
|
+
let(:ssl) { true }
|
24
|
+
specify { Yummly::UrlBuilder.domain.should == "https://api.yummly.com" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe ".protocol" do
|
29
|
+
context "when ssl is not enabled" do
|
30
|
+
specify { Yummly::UrlBuilder.protocol.should == "http" }
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when ssl is enabled" do
|
34
|
+
let(:ssl) { true }
|
35
|
+
specify { Yummly::UrlBuilder.protocol.should == "https" }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe ".build_params_query_string" do
|
40
|
+
let(:query_string) { Yummly::UrlBuilder.build_params_query_string(:name => 'test') }
|
41
|
+
it "contains the app key" do
|
42
|
+
query_string.should match /_app_key=#{app_key}/
|
43
|
+
end
|
44
|
+
it "contains the app id" do
|
45
|
+
query_string.should match /_app_id=#{app_id}/
|
46
|
+
end
|
47
|
+
it "contains the name parameter" do
|
48
|
+
query_string.should match /name=test/
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe ".uri" do
|
53
|
+
let(:uri) { Yummly::UrlBuilder.uri(:search, :name => 'test') }
|
54
|
+
specify { uri.should == "/#{Yummly::API_VERSION}/api/search?name=test&_app_id=123456&_app_key=ABCDEFG123456"}
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/spec/yummly_spec.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Yummly do
|
4
|
-
subject { Yummly::Configuration.new }
|
5
4
|
|
6
5
|
describe ".configure" do
|
7
|
-
let(:app_id) {
|
8
|
-
let(:app_key) {
|
6
|
+
let(:app_id) { "12345" }
|
7
|
+
let(:app_key) { "XEARSGSTH12345789" }
|
9
8
|
|
10
9
|
before do
|
11
10
|
Yummly.configure do |config|
|
@@ -13,14 +12,11 @@ describe Yummly do
|
|
13
12
|
config.app_id = app_id
|
14
13
|
config.app_key = app_key
|
15
14
|
end
|
16
|
-
|
17
|
-
UrlMocks.register_api_url_stubs
|
18
15
|
end
|
19
16
|
|
20
17
|
specify { Yummly.configuration.use_ssl?.should be_true }
|
21
18
|
specify { Yummly.configuration.app_id.should == app_id }
|
22
19
|
specify { Yummly.configuration.app_key.should == app_key }
|
23
|
-
specify { Yummly.search("soup recipes").should be_an_instance_of(Array)}
|
24
20
|
end
|
25
21
|
|
26
22
|
end
|
data/yummly.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yummly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theo Mills
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: webmock
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - '>='
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
description: Ruby wrapper to the Yummly API
|
84
70
|
email:
|
85
71
|
- twmills@twmills.com
|
@@ -109,9 +95,12 @@ files:
|
|
109
95
|
- lib/yummly/url_builder.rb
|
110
96
|
- lib/yummly/version.rb
|
111
97
|
- spec/configuration_spec.rb
|
112
|
-
- spec/
|
98
|
+
- spec/connection_spec.rb
|
99
|
+
- spec/fixtures/get_recipe.json
|
100
|
+
- spec/fixtures/search_response.json
|
113
101
|
- spec/spec_helper.rb
|
114
|
-
- spec/
|
102
|
+
- spec/support/mock_http_adapter.rb
|
103
|
+
- spec/url_builder_spec.rb
|
115
104
|
- spec/yummly_spec.rb
|
116
105
|
- yummly.gemspec
|
117
106
|
homepage: https://github.com/twmills/yummly
|
@@ -139,8 +128,11 @@ specification_version: 4
|
|
139
128
|
summary: Ruby wrapper to the Yummly API
|
140
129
|
test_files:
|
141
130
|
- spec/configuration_spec.rb
|
142
|
-
- spec/
|
131
|
+
- spec/connection_spec.rb
|
132
|
+
- spec/fixtures/get_recipe.json
|
133
|
+
- spec/fixtures/search_response.json
|
143
134
|
- spec/spec_helper.rb
|
144
|
-
- spec/
|
135
|
+
- spec/support/mock_http_adapter.rb
|
136
|
+
- spec/url_builder_spec.rb
|
145
137
|
- spec/yummly_spec.rb
|
146
138
|
has_rdoc:
|
data/spec/url_mocks.rb
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
module UrlMocks
|
2
|
-
def self.register_api_url_stubs
|
3
|
-
File.open(File.join(File.dirname(__FILE__), "fixtures", "search_response.txt")) do |file|
|
4
|
-
WebMock::API.stub_request(:get, Regexp.new(Yummly::Connection.domain + "/v1/api/recipes?" + ".*")).to_return(status: 200, body: file)
|
5
|
-
end
|
6
|
-
#stub_request(:any, Regexp.new(Yummly::Connection.domain + ".*")).to_return(:body => "Catch all error until urls are defined.", :status => 501 )
|
7
|
-
end
|
8
|
-
end
|