zutat 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/LICENSE +22 -0
- data/lib/zutat/client.rb +16 -0
- data/lib/zutat/ingredient.rb +23 -0
- data/lib/zutat/recipe.rb +17 -0
- data/lib/zutat/version.rb +3 -0
- data/lib/zutat.rb +10 -0
- data/zutat.gemspec +16 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5019c14c0fd775bd0249778297253eedf420bd19
|
4
|
+
data.tar.gz: 518ee6c0ac9af014cd3b49c8d959084d87f13684
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 33440808b108bca43b64700c0f3314b9b19ffacbccfb3d37f77cd0b38a9f556914232eb46990429d2315028a8bb63ba4a7f115c8ea9fed6abf4f1626728ab43c
|
7
|
+
data.tar.gz: 82a62106303f63d9f8025a950033b0038a5ba3ff7a1856d58239ff9e547f070f36f1b0b0156667e094da01fd1bbc7c6cf185e101970509e1e42fb516a8ec3b2c
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Eddy Shure
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/lib/zutat/client.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Zutat
|
2
|
+
class Client
|
3
|
+
URL = "https://diy.soylent.me/recipes/"
|
4
|
+
|
5
|
+
def get_recipe(id)
|
6
|
+
if not id.is_a? String
|
7
|
+
raise "invalid recipe id."
|
8
|
+
end
|
9
|
+
|
10
|
+
@url = URI((URL + id + "/json"))
|
11
|
+
@res = Net::HTTP.get(@url)
|
12
|
+
|
13
|
+
return Zutat::Recipe.new(@res)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Zutat
|
2
|
+
class Ingredient
|
3
|
+
attr_accessor :_id, :amount, :biotin, :calcium, :calories, :carbs, :chloride, :cholesterol,
|
4
|
+
:choline, :chromium, :container_size, :copper, :fat, :fiber, :folate, :form, :insoluble_fiber,
|
5
|
+
:iodine, :iron, :item_cost, :maganese, :magnesium, :molybdenum, :monounsaturated_fat, :name,
|
6
|
+
:niacin, :omega_3, :omega_6, :panthothenic, :persistedAsin, :phosphorus, :polyunsaturated_fat,
|
7
|
+
:potassium, :protein, :riboflavin, :saturated_fat, :selinium, :serving, :sodium, :soluble_fiber,
|
8
|
+
:source, :sulfur, :thiamin, :unit, :url, :vitamin_a, :vitamin_b12, :vitamin_b6, :vitamin_c,
|
9
|
+
:vitamin_d, :vitamin_e, :vitamin_k, :zinc, :currency, :asin, :volumeStr, :id
|
10
|
+
|
11
|
+
def initialize(igrdnts)
|
12
|
+
igrdnts.each do |k,v|
|
13
|
+
m = k.gsub('-', '_')
|
14
|
+
send("#{m}=",v)
|
15
|
+
|
16
|
+
if m.is_a? String and m.is_empty?
|
17
|
+
send("#{m}=",nil)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/zutat/recipe.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Zutat
|
2
|
+
class Recipe
|
3
|
+
attr_accessor :ingredients, :nutrient_targets
|
4
|
+
|
5
|
+
def initialize(p)
|
6
|
+
@json = JSON.parse(p)
|
7
|
+
@ingredients = Array.new
|
8
|
+
|
9
|
+
@json["ingredients"].each do |n|
|
10
|
+
ingredient = Zutat::Ingredient.new(n)
|
11
|
+
p ingredient
|
12
|
+
@ingredients << ingredient
|
13
|
+
end
|
14
|
+
@nutrient_targets = nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/zutat.rb
ADDED
data/zutat.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
|
3
|
+
s.name = 'zutat'
|
4
|
+
s.version = '0.0.1'
|
5
|
+
s.date = '2014-10-03'
|
6
|
+
s.summary = "Get Soylent recipes from diy.soylent.me."
|
7
|
+
s.description = "asurements and even stop measurements."
|
8
|
+
s.authors = ["Eddy Shure"]
|
9
|
+
s.files = `git ls-files`.split($/)
|
10
|
+
s.licenses = ['MIT']
|
11
|
+
s.homepage = 'https://github.com/EddyShure/zutat'
|
12
|
+
s.required_ruby_version = '>= 1.9'
|
13
|
+
|
14
|
+
s.add_development_dependency('json')
|
15
|
+
s.add_development_dependency('rest-client')
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zutat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eddy Shure
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
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.
|
42
|
+
email:
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- LICENSE
|
49
|
+
- lib/zutat.rb
|
50
|
+
- lib/zutat/client.rb
|
51
|
+
- lib/zutat/ingredient.rb
|
52
|
+
- lib/zutat/recipe.rb
|
53
|
+
- lib/zutat/version.rb
|
54
|
+
- zutat.gemspec
|
55
|
+
homepage: https://github.com/EddyShure/zutat
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.9'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.1.9
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Get Soylent recipes from diy.soylent.me.
|
79
|
+
test_files: []
|