daily_recipe 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eee8d4005c4150285ce6ac8ab2ad8a2c1dc196ba
4
- data.tar.gz: 724a4372c0b6e934a6efcc54c9136377ff86b7ee
3
+ metadata.gz: 186bcd1c8dd1f14c6125ec04fcdd9f558d39a883
4
+ data.tar.gz: 8698f93d2d6c5892a0c57ce1cf245f6cf3e5b9c7
5
5
  SHA512:
6
- metadata.gz: 336d0ee7ffda4abeb02117ea841d73ef80094029f01aa6b95a7720681087d733dbd76992a7027143161fdd00fcd6f2187e328c286e2769915ed5ab7574e5f6a0
7
- data.tar.gz: 084831fcd5323bc21b27b0f0f8e2f61ed89daa3802ef02bf57012ae3ba2df6976793bfe00269f007e040864869854aa59bb482d47888173bfd89ae39be5726b7
6
+ metadata.gz: dad02a1f617c5a5f2531d010340a7b4327e0ab2a7f9dacb8889b1d491f99887bae17dbccdeb8d1993fe541baa106e9c73b054ed45a95851ac3f92c9b43ca33c6
7
+ data.tar.gz: dc788ec81364c5b9aad91ee5d966d99fd3eb0827edf14f5ae0d0f07ff885648347d872300e5c7a1dd702c22561d04484c8a7880291b7466a74802ad3c89d4c1b
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  To use this gem, install using 'gem install daily_recipe'.
23
23
  To run, simply type 'daily_recipe' once the gem has been installed.
24
- A list of recipes will be loaded. Select an option to get ingredients and further instructions.
24
+ A list of recipes will be loaded. Select an option to get ingredients and cooking instructions.
25
25
 
26
26
  ## Development
27
27
 
data/bin/daily_recipe CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require './lib/daily_recipe'
3
+ require_relative './lib/daily_recipe'
4
4
 
5
5
  DailyRecipe::CLI.new.call
Binary file
@@ -7,16 +7,10 @@ class DailyRecipe::Recipe
7
7
  self.scrape_food_network
8
8
  end
9
9
 
10
-
11
- # def self.scrape_recipes
12
- # self.scrape_food_network
13
- # end
14
-
15
10
  def self.scrape_food_network
16
11
  recipes = []
17
12
  doc = Nokogiri::HTML(open("http://www.foodnetwork.com/recipes/photos/recipe-of-the-day-what-to-cook-now.html"))
18
13
  doc.search(".feed li").each do |x|
19
- #binding.pry
20
14
  recipe = self.new
21
15
  recipe.name = x.search("h6 a").text
22
16
  recipe.cook_time = x.search("dd").text
@@ -35,10 +29,9 @@ class DailyRecipe::Recipe
35
29
  part1 = recipe_json.text.gsub("gigya._.apiAdapters.web.callback(","")
36
30
  part2 = part1.gsub("});","}")
37
31
  parsed = JSON.parse(part2, symbolize_names: true)
38
- #binding.pry
39
32
  rating = parsed[:streamInfo][:avgRatings][:_overall]
40
33
  rating
41
- end
34
+ end #Parses JSON to get access to the gigya API info in order to scrape the ratings information.
42
35
 
43
36
  def self.scrape_full_recipe(the_recipe)
44
37
 
@@ -11,11 +11,13 @@ class DailyRecipe::CLI
11
11
  def list_recipes
12
12
  #will get recipes
13
13
  @recipes = DailyRecipe::Recipe.today
14
- puts " Recipe name Rating Cooking Time"
14
+ rows = [] # terminal-table formatting
15
+ rows << ["Number", "Recipe Name", "Rating", "Cooking Time"]
15
16
  @recipes.each.with_index(1) do |recipe, i| #There is a Recipe class with a #today method for today's recipes
16
-
17
- puts "#{i}. #{recipe.name} - #{recipe.rating} - #{recipe.cook_time}"
17
+ rows << [i, recipe.name, "#{recipe.rating} / 5", recipe.cook_time]
18
18
  end
19
+ table = Terminal::Table.new :rows => rows #AWESOME!
20
+ puts table
19
21
  end
20
22
 
21
23
  def menu
@@ -27,7 +29,7 @@ class DailyRecipe::CLI
27
29
  puts "Type exit to exit"
28
30
  input = gets.strip.downcase
29
31
 
30
- if input.to_i > 0 and input.to_i <= @recipes.count
32
+ if input.to_i > 0 and input.to_i <= @recipes.count
31
33
  the_recipe = @recipes[input.to_i-1]
32
34
  puts "#{the_recipe.name} - #{the_recipe.rating} - #{the_recipe.cook_time}"
33
35
  DailyRecipe::Recipe.scrape_full_recipe(the_recipe)
@@ -43,6 +45,6 @@ class DailyRecipe::CLI
43
45
  end
44
46
 
45
47
  def goodbye
46
- puts "Please join us tomorrow for more amazing recipes!"
48
+ puts "Please visit again for more amazing recipes!"
47
49
  end
48
50
  end
@@ -1,3 +1,3 @@
1
1
  module DailyRecipe
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daily_recipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian DeVivi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,6 +99,7 @@ files:
99
99
  - bin/console
100
100
  - bin/daily_recipe
101
101
  - bin/setup
102
+ - daily_recipe-0.1.0.gem
102
103
  - daily_recipe.gemspec
103
104
  - lib/daily_recipe.rb
104
105
  - lib/daily_recipe/Recipe.rb
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
125
  version: '0'
125
126
  requirements: []
126
127
  rubyforge_project:
127
- rubygems_version: 2.4.5.1
128
+ rubygems_version: 2.6.6
128
129
  signing_key:
129
130
  specification_version: 4
130
131
  summary: Daily Recipes List