zutat 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 310930a2707f4c90b5a2e9980c01b15fb6005d35
4
- data.tar.gz: 360599b5f8685ee2c21ffc77c532ff99c6cb4237
3
+ metadata.gz: da41dc0bc781059e0e457538321a9e5392817f1b
4
+ data.tar.gz: 9b5c10b6e46ad189e1f8de570ac92230e081cfed
5
5
  SHA512:
6
- metadata.gz: 2f2473fc8bd6c21bdd3a5374777f6175b19b3892617886f743351473521d6e798d807305497a4ac289e1ad17d31e03d1f48e147682bf37d795cd47a443492e6e
7
- data.tar.gz: 3f1c9f42d0c3dff567f148dfb48c664b95a8d93f51a59dd4eb80d96347f8bc03ba0caa1416c45e5ada3736a8e53e5342f5bf1b9473be5b75965aa411947d98a6
6
+ metadata.gz: 0689db0641f78358555f93ea7604d2320b53fadc9abab732f8dc75e37919c0d002df684095c32d8c905b019493f42308f47305ab0a828eec38bf49e4aedf7f25
7
+ data.tar.gz: 6353e7e7a108a2d3653fe3cbc23170461bd7c9bd77ee2a327682c05ed36c2e9666add7a4e73054f20ac08b4424f33e04f7a0162510612b7ac9b93c1cebe966c1
data/README.md CHANGED
@@ -15,19 +15,33 @@ At first, you should require the gem. Otherwise it won't work.
15
15
  ```ruby
16
16
  require 'zutat'
17
17
  ```
18
- ## Initialize a client
18
+ ### Initialize a client
19
19
  Then you must initialize a new client.
20
20
  ```ruby
21
21
  client = Zutat::Client.new
22
22
  ```
23
23
 
24
- ## Getting recipes
25
- Now you can get a recipe by its ID. If I want the "People Chow 3.0.1" recipe, I type:
24
+ ### Fetch a recipe
25
+ At this point, you can get a recipe by its ID. If I want the "People Chow 3.0.1" recipe, I type:
26
26
  ```ruby
27
27
  recipe = client.get_recipe "people-chow-301-tortilla-perfection"
28
28
  ```
29
29
 
30
+ ### Using the recipe object
31
+ If I want to know, how many calories are specified as nutrient target I simply use:
32
+ ```ruby
33
+ puts recipe.nutrient_targets.calories
34
+ ```
35
+
36
+ Or when I want to know the source (to buy) for each ingredient in this recipe:
37
+ ```ruby
38
+ recipe.ingredients.each do |ingredient|
39
+ puts ingredient.source
40
+ end
41
+ ```
42
+
30
43
  ## TODO
44
+ * Adding index with all objects
31
45
  * Adding search feature
32
46
  * Optimizing attributes from Zutat::Ingredients and Zutat::NutrientTargets
33
47
 
data/lib/zutat/client.rb CHANGED
@@ -3,9 +3,7 @@ module Zutat
3
3
  URL = "https://diy.soylent.me/recipes/"
4
4
 
5
5
  def get_recipe(id)
6
- if not id.is_a? String
7
- raise "invalid recipe id."
8
- end
6
+ raise "invalid recipe id." unless id.is_a? String
9
7
 
10
8
  @url = URI((URL + id + "/json"))
11
9
  @res = Net::HTTP.get(@url)
data/lib/zutat/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Zutat
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
data/zutat.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'zutat'
4
- s.version = '0.0.2'
4
+ s.version = '0.0.3'
5
5
  s.date = '2014-10-04'
6
6
  s.summary = "Get Soylent recipes from diy.soylent.me."
7
7
  s.description = "Fetch Soylent recipes from diy.soylent.me and get easy-to-use Ruby objects."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zutat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Shure