zutat 0.0.1 → 0.0.2

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: 5019c14c0fd775bd0249778297253eedf420bd19
4
- data.tar.gz: 518ee6c0ac9af014cd3b49c8d959084d87f13684
3
+ metadata.gz: 310930a2707f4c90b5a2e9980c01b15fb6005d35
4
+ data.tar.gz: 360599b5f8685ee2c21ffc77c532ff99c6cb4237
5
5
  SHA512:
6
- metadata.gz: 33440808b108bca43b64700c0f3314b9b19ffacbccfb3d37f77cd0b38a9f556914232eb46990429d2315028a8bb63ba4a7f115c8ea9fed6abf4f1626728ab43c
7
- data.tar.gz: 82a62106303f63d9f8025a950033b0038a5ba3ff7a1856d58239ff9e547f070f36f1b0b0156667e094da01fd1bbc7c6cf185e101970509e1e42fb516a8ec3b2c
6
+ metadata.gz: 2f2473fc8bd6c21bdd3a5374777f6175b19b3892617886f743351473521d6e798d807305497a4ac289e1ad17d31e03d1f48e147682bf37d795cd47a443492e6e
7
+ data.tar.gz: 3f1c9f42d0c3dff567f148dfb48c664b95a8d93f51a59dd4eb80d96347f8bc03ba0caa1416c45e5ada3736a8e53e5342f5bf1b9473be5b75965aa411947d98a6
@@ -0,0 +1,45 @@
1
+ # zutat
2
+
3
+ zutat is a small Ruby gem which allows you to simply get and work with recipes from diy.soylent.me. It is is dead-simple and you can easily get Soylent recipes for your project.
4
+
5
+ FYI: "zutat" is German and means ingredient.
6
+
7
+ ## Installation
8
+ Just install the gem from RubyGems.
9
+ ```
10
+ gem install zutat
11
+ ```
12
+
13
+ ## Usage
14
+ At first, you should require the gem. Otherwise it won't work.
15
+ ```ruby
16
+ require 'zutat'
17
+ ```
18
+ ## Initialize a client
19
+ Then you must initialize a new client.
20
+ ```ruby
21
+ client = Zutat::Client.new
22
+ ```
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:
26
+ ```ruby
27
+ recipe = client.get_recipe "people-chow-301-tortilla-perfection"
28
+ ```
29
+
30
+ ## TODO
31
+ * Adding search feature
32
+ * Optimizing attributes from Zutat::Ingredients and Zutat::NutrientTargets
33
+
34
+ ## Support
35
+ If you like my work, you can support me via Gratipay, Flattr or a Bitcoin donation:
36
+
37
+ <a href="https://www.gittip.com/EddyShure/">
38
+ <img alt="Support via Gittip" src="https://rawgithub.com/twolfson/gittip-badge/0.2.0/dist/gittip.png"/>
39
+ </a>
40
+
41
+ [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=EddyShure&url=https://github.com/EddyShure/zutat&title=zutat&language=Ruby&tags=github&category=software)
42
+
43
+ ```
44
+ 1n5cZr1h3kVxt9gChCBueb1J5feL8RgZZ
45
+ ```
@@ -8,3 +8,4 @@ require 'zutat/version'
8
8
  require 'zutat/client'
9
9
  require 'zutat/recipe'
10
10
  require 'zutat/ingredient'
11
+ require 'zutat/nutrient-targets'
@@ -13,10 +13,10 @@ module Zutat
13
13
  m = k.gsub('-', '_')
14
14
  send("#{m}=",v)
15
15
 
16
- if m.is_a? String and m.is_empty?
16
+ if v.is_a? String and v.empty?
17
17
  send("#{m}=",nil)
18
18
  end
19
-
19
+
20
20
  end
21
21
  end
22
22
  end
@@ -0,0 +1,19 @@
1
+ module Zutat
2
+ class NutrientTargets
3
+ attr_accessor :zinc_max, :zinc, :vitamin_k_max, :vitamin_k, :vitamin_e_max, :vitamin_e, :vitamin_d_max,
4
+ :vitamin_d, :vitamin_c_max, :vitamin_c, :vitamin_b6_max, :vitamin_b6, :vitamin_b12_max, :vitamin_b12,
5
+ :vitamin_a_max, :vitamin_a, :thiamin_max, :thiamin, :sulfur_max, :sulfur, :sodium_max, :sodium, :selinium_max,
6
+ :selinium, :riboflavin_max, :riboflavin, :protein_max, :protein, :potassium_max, :potassium, :phosphorus_max,
7
+ :phosphorus, :panthothenic_max, :panthothenic, :omega_6_max, :omega_6, :omega_3_max, :omega_3, :niacin_max,
8
+ :niacin, :name, :molybdenum_max, :molybdenum, :magnesium_max, :magnesium, :maganese_max, :maganese, :iron_max,
9
+ :iron, :iodine_max, :iodine, :folate_max, :folate, :fiber_max, :fiber, :fat_max, :fat, :copper_max, :copper,
10
+ :chromium_max, :chromium, :choline_max, :choline, :cholesterol_max, :cholesterol, :chloride_max, :chloride,
11
+ :carbs_max, :carbs, :calories_max, :calories, :calcium_max, :calcium, :biotin_max, :biotin
12
+
13
+ def initialize(nt)
14
+ nt.each do |k,v|
15
+ send("#{k}=",v)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -8,10 +8,9 @@ module Zutat
8
8
 
9
9
  @json["ingredients"].each do |n|
10
10
  ingredient = Zutat::Ingredient.new(n)
11
- p ingredient
12
11
  @ingredients << ingredient
13
- end
14
- @nutrient_targets = nil
12
+ end
13
+ @nutrient_targets = Zutat::NutrientTargets.new(@json["nutrientTargets"])
15
14
  end
16
15
  end
17
16
  end
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'zutat'
4
- s.version = '0.0.1'
5
- s.date = '2014-10-03'
4
+ s.version = '0.0.2'
5
+ s.date = '2014-10-04'
6
6
  s.summary = "Get Soylent recipes from diy.soylent.me."
7
- s.description = "asurements and even stop measurements."
7
+ s.description = "Fetch Soylent recipes from diy.soylent.me and get easy-to-use Ruby objects."
8
8
  s.authors = ["Eddy Shure"]
9
9
  s.files = `git ls-files`.split($/)
10
10
  s.licenses = ['MIT']
@@ -12,5 +12,4 @@ Gem::Specification.new do |s|
12
12
  s.required_ruby_version = '>= 1.9'
13
13
 
14
14
  s.add_development_dependency('json')
15
- s.add_development_dependency('rest-client')
16
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zutat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Shure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-03 00:00:00.000000000 Z
11
+ date: 2014-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -24,21 +24,7 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rest-client
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '>='
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '>='
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- description: asurements and even stop measurements.
27
+ description: Fetch Soylent recipes from diy.soylent.me and get easy-to-use Ruby objects.
42
28
  email:
43
29
  executables: []
44
30
  extensions: []
@@ -46,9 +32,11 @@ extra_rdoc_files: []
46
32
  files:
47
33
  - .gitignore
48
34
  - LICENSE
35
+ - README.md
49
36
  - lib/zutat.rb
50
37
  - lib/zutat/client.rb
51
38
  - lib/zutat/ingredient.rb
39
+ - lib/zutat/nutrient-targets.rb
52
40
  - lib/zutat/recipe.rb
53
41
  - lib/zutat/version.rb
54
42
  - zutat.gemspec