daily_recipe 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/daily_recipe +3 -1
- data/lib/daily_recipe/Recipe.rb +3 -3
- data/lib/daily_recipe/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0161fdc31de01687e7285bf574b60f10737be5d4
|
4
|
+
data.tar.gz: 97acceba362c0a6514fe154ea8818cb50ba66f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b3a1bb5e1ed3d66986fe6813cba971d61ba4380cff771671df3bf47ae3c0c1bb2a3e93b757019321e4f5e4f4c041bb336ec140642ef2e55a8cf564115710bf
|
7
|
+
data.tar.gz: f3e458d9574f5c6a4c9368f2e5b6b66137bea11d7f82e2c7624ab9f1786f1c0426d14132af28b5d5a6f740129f8d2ff9f0d53ddd9773585662881eb2092c11c8
|
data/bin/daily_recipe
CHANGED
data/lib/daily_recipe/Recipe.rb
CHANGED
@@ -2,7 +2,7 @@ require 'json'
|
|
2
2
|
class DailyRecipe::Recipe
|
3
3
|
|
4
4
|
attr_accessor :name, :cook_time, :rating, :api_id, :url
|
5
|
-
|
5
|
+
@base_url = "http://www.foodnetwork.com"
|
6
6
|
def self.today
|
7
7
|
self.scrape_food_network
|
8
8
|
end
|
@@ -15,7 +15,7 @@ class DailyRecipe::Recipe
|
|
15
15
|
recipe.name = x.search("h6 a").text
|
16
16
|
recipe.cook_time = x.search("dd").text
|
17
17
|
recipe.api_id = (x.css("a.community-rating-stars").attribute("data-rating").value).scan(/\w+\-.+\w+/).join("-")
|
18
|
-
recipe.url =
|
18
|
+
recipe.url = @base_url + x.search(".community-rating-stars").attribute("href").value
|
19
19
|
recipe.rating = get_rating(recipe.api_id)
|
20
20
|
recipes << recipe
|
21
21
|
end
|
@@ -31,7 +31,7 @@ class DailyRecipe::Recipe
|
|
31
31
|
parsed = JSON.parse(part2, symbolize_names: true)
|
32
32
|
rating = parsed[:streamInfo][:avgRatings][:_overall]
|
33
33
|
rating
|
34
|
-
end #Parses JSON to get access to the gigya API info in order to scrape the ratings information.
|
34
|
+
end #Parses JSON to get access to the gigya API info in order to scrape the ratings information.
|
35
35
|
|
36
36
|
def self.scrape_full_recipe(the_recipe)
|
37
37
|
|
data/lib/daily_recipe/version.rb
CHANGED