encuisine 0.2.0 → 0.3.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +64 -0
- data/LICENSE.txt +1 -1
- data/README.md +9 -0
- data/lib/encuisine/food.rb +25 -0
- data/lib/encuisine/recipe.rb +1 -1
- data/lib/encuisine/version.rb +1 -1
- data/lib/encuisine.rb +5 -7
- metadata +8 -7
- data/encuisine.gemspec +0 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 709198d5e0d9409712760bb35814cbacad44d1d6406622be963d33b1b7d67f27
|
|
4
|
+
data.tar.gz: b13a69af542054cb9e38b5fe05973de59c3469bd69a0556bbe07530e6a78a48f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18c0a070cb06c5e1b4b74c7afc61d68c20cf19e70f5b7beac84ddc34095c5de44442eb1014e80ddda30e45b0d9043f32c35708246f30f723097e06a3d6bdcd79
|
|
7
|
+
data.tar.gz: b8ce0b02560d6cf18e9ae1bcb6b5b244de3c24539ab297f9113915c9d35ba613fa6d15b76f35c32246395540c35187ee90f762c3845eba37d0e3e40b204e1bf1
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
encuisine (0.2.0)
|
|
5
|
+
faraday (~> 2.2)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
ast (2.4.2)
|
|
11
|
+
diff-lcs (1.5.0)
|
|
12
|
+
faraday (2.7.4)
|
|
13
|
+
faraday-net_http (>= 2.0, < 3.1)
|
|
14
|
+
ruby2_keywords (>= 0.0.4)
|
|
15
|
+
faraday-net_http (3.0.2)
|
|
16
|
+
json (2.6.3)
|
|
17
|
+
parallel (1.22.1)
|
|
18
|
+
parser (3.2.2.0)
|
|
19
|
+
ast (~> 2.4.1)
|
|
20
|
+
rainbow (3.1.1)
|
|
21
|
+
rake (13.0.6)
|
|
22
|
+
regexp_parser (2.7.0)
|
|
23
|
+
rexml (3.2.5)
|
|
24
|
+
rspec (3.12.0)
|
|
25
|
+
rspec-core (~> 3.12.0)
|
|
26
|
+
rspec-expectations (~> 3.12.0)
|
|
27
|
+
rspec-mocks (~> 3.12.0)
|
|
28
|
+
rspec-core (3.12.1)
|
|
29
|
+
rspec-support (~> 3.12.0)
|
|
30
|
+
rspec-expectations (3.12.2)
|
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
+
rspec-support (~> 3.12.0)
|
|
33
|
+
rspec-mocks (3.12.5)
|
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
+
rspec-support (~> 3.12.0)
|
|
36
|
+
rspec-support (3.12.0)
|
|
37
|
+
rubocop (1.49.0)
|
|
38
|
+
json (~> 2.3)
|
|
39
|
+
parallel (~> 1.10)
|
|
40
|
+
parser (>= 3.2.0.0)
|
|
41
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
42
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
43
|
+
rexml (>= 3.2.5, < 4.0)
|
|
44
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
|
45
|
+
ruby-progressbar (~> 1.7)
|
|
46
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
47
|
+
rubocop-ast (1.28.0)
|
|
48
|
+
parser (>= 3.2.1.0)
|
|
49
|
+
ruby-progressbar (1.13.0)
|
|
50
|
+
ruby2_keywords (0.0.5)
|
|
51
|
+
unicode-display_width (2.4.2)
|
|
52
|
+
|
|
53
|
+
PLATFORMS
|
|
54
|
+
aarch64-linux
|
|
55
|
+
|
|
56
|
+
DEPENDENCIES
|
|
57
|
+
encuisine!
|
|
58
|
+
faraday (~> 2.2)
|
|
59
|
+
rake (~> 13.0)
|
|
60
|
+
rspec (~> 3.0)
|
|
61
|
+
rubocop (~> 1.21)
|
|
62
|
+
|
|
63
|
+
BUNDLED WITH
|
|
64
|
+
2.4.10
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -26,6 +26,15 @@ Encuisine::Recipe.get(id)
|
|
|
26
26
|
|
|
27
27
|
# Create a recipe
|
|
28
28
|
Encuisine::Recipe.create(json)
|
|
29
|
+
|
|
30
|
+
# List all foods
|
|
31
|
+
Encuisine::Food.all
|
|
32
|
+
|
|
33
|
+
# Search a food
|
|
34
|
+
Encuisine::Food.search("Carotte")
|
|
35
|
+
|
|
36
|
+
# Get a food
|
|
37
|
+
Encuisine::Food.get(id)
|
|
29
38
|
```
|
|
30
39
|
|
|
31
40
|
## Development
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Encuisine
|
|
4
|
+
class Food
|
|
5
|
+
class << self
|
|
6
|
+
def all
|
|
7
|
+
response = Connection.json.get("#{BASE_URL}/api/v1/foods")
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get(id)
|
|
11
|
+
if id
|
|
12
|
+
response = Connection.json.get("#{BASE_URL}/api/v1/foods/#{id}")
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def search(query)
|
|
17
|
+
if query
|
|
18
|
+
response = Connection.json.get("#{BASE_URL}/api/v1/foods") do |request|
|
|
19
|
+
request.params["q"] = query
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/encuisine/recipe.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Encuisine
|
|
|
15
15
|
|
|
16
16
|
def search(query)
|
|
17
17
|
if query
|
|
18
|
-
response = Connection.json.
|
|
18
|
+
response = Connection.json.get("#{BASE_URL}/api/v1/recipes") do |request|
|
|
19
19
|
request.params["q"] = query
|
|
20
20
|
end
|
|
21
21
|
end
|
data/lib/encuisine/version.rb
CHANGED
data/lib/encuisine.rb
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "encuisine/connection"
|
|
4
|
+
require_relative "encuisine/food"
|
|
4
5
|
require_relative "encuisine/recipe"
|
|
5
6
|
require_relative "encuisine/version"
|
|
6
7
|
|
|
8
|
+
require "faraday"
|
|
9
|
+
|
|
7
10
|
module Encuisine
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
BASE_URL = "https://#{DEFAULT_DOMAIN}"
|
|
11
|
-
else
|
|
12
|
-
DEFAULT_DOMAIN = "localhost:3000"
|
|
13
|
-
BASE_URL = "http://#{DEFAULT_DOMAIN}"
|
|
14
|
-
end
|
|
11
|
+
DEFAULT_DOMAIN = "api.encuisine.org"
|
|
12
|
+
BASE_URL = "https://#{DEFAULT_DOMAIN}"
|
|
15
13
|
|
|
16
14
|
class Error < StandardError; end
|
|
17
15
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: encuisine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cyril Blaecke
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-04-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -36,12 +36,13 @@ files:
|
|
|
36
36
|
- CHANGELOG.md
|
|
37
37
|
- CODE_OF_CONDUCT.md
|
|
38
38
|
- Gemfile
|
|
39
|
+
- Gemfile.lock
|
|
39
40
|
- LICENSE.txt
|
|
40
41
|
- README.md
|
|
41
42
|
- Rakefile
|
|
42
|
-
- encuisine.gemspec
|
|
43
43
|
- lib/encuisine.rb
|
|
44
44
|
- lib/encuisine/connection.rb
|
|
45
|
+
- lib/encuisine/food.rb
|
|
45
46
|
- lib/encuisine/recipe.rb
|
|
46
47
|
- lib/encuisine/version.rb
|
|
47
48
|
- sig/encuisine.rbs
|
|
@@ -53,7 +54,7 @@ metadata:
|
|
|
53
54
|
homepage_uri: https://github.com/encuisineorg/encuisine-ruby
|
|
54
55
|
source_code_uri: https://github.com/encuisineorg/encuisine-ruby
|
|
55
56
|
changelog_uri: https://github.com/encuisineorg/encuisine-ruby/CHANGELOG.md
|
|
56
|
-
post_install_message:
|
|
57
|
+
post_install_message:
|
|
57
58
|
rdoc_options: []
|
|
58
59
|
require_paths:
|
|
59
60
|
- lib
|
|
@@ -68,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
68
69
|
- !ruby/object:Gem::Version
|
|
69
70
|
version: '0'
|
|
70
71
|
requirements: []
|
|
71
|
-
rubygems_version: 3.
|
|
72
|
-
signing_key:
|
|
72
|
+
rubygems_version: 3.4.10
|
|
73
|
+
signing_key:
|
|
73
74
|
specification_version: 4
|
|
74
75
|
summary: En Cuisine API wrapper
|
|
75
76
|
test_files: []
|
data/encuisine.gemspec
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/encuisine/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "encuisine"
|
|
7
|
-
spec.version = Encuisine::VERSION
|
|
8
|
-
spec.authors = ["Cyril Blaecke"]
|
|
9
|
-
spec.email = ["cyril@dilolabs.fr"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "En Cuisine API wrapper"
|
|
12
|
-
spec.description = "En Cuisine ! API wrapper, the open database about recipes."
|
|
13
|
-
spec.homepage = "https://github.com/encuisineorg/encuisine-ruby"
|
|
14
|
-
spec.license = "MIT"
|
|
15
|
-
spec.required_ruby_version = ">= 2.6.0"
|
|
16
|
-
|
|
17
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
18
|
-
|
|
19
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/CHANGELOG.md"
|
|
22
|
-
|
|
23
|
-
# Specify which files should be added to the gem when it is released.
|
|
24
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
25
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
spec.bindir = "exe"
|
|
31
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
32
|
-
spec.require_paths = ["lib"]
|
|
33
|
-
|
|
34
|
-
spec.add_dependency "faraday", "~> 2.2"
|
|
35
|
-
end
|