encuisine 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898ee180446c1cacf6d3ff7af2ed4affb1d11a3f54193719215b8b39142efbfc
4
- data.tar.gz: 2fc247bd4c985e624297d5c8c8f277fb20c863517452e0b53c5566ab3f120ccf
3
+ metadata.gz: 709198d5e0d9409712760bb35814cbacad44d1d6406622be963d33b1b7d67f27
4
+ data.tar.gz: b13a69af542054cb9e38b5fe05973de59c3469bd69a0556bbe07530e6a78a48f
5
5
  SHA512:
6
- metadata.gz: 32777259df90d001902b5e491fdebf33e010a2f4300c2bb8217425ceb7b55cc45b8d2337b9bff247ef519bf2f6821fc6a5c5d8d9069cd3f90e02ec7d54069c32
7
- data.tar.gz: a92f631992e617fb18138672f654220f64b170c0c13133b516ff4781dbb1a12d568777d314a36c5469a46db23cea9cfa9bf1c7f0c69dbcd5980b393e4d50cc73
6
+ metadata.gz: 18c0a070cb06c5e1b4b74c7afc61d68c20cf19e70f5b7beac84ddc34095c5de44442eb1014e80ddda30e45b0d9043f32c35708246f30f723097e06a3d6bdcd79
7
+ data.tar.gz: b8ce0b02560d6cf18e9ae1bcb6b5b244de3c24539ab297f9113915c9d35ba613fa6d15b76f35c32246395540c35187ee90f762c3845eba37d0e3e40b204e1bf1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2023-04-10
4
+
5
+ - Add list, search and get on foods
6
+
7
+ ## [0.2.0] - 2022-04-15
8
+
9
+ - Add list all recipes
10
+
3
11
  ## [0.1.0] - 2022-04-08
4
12
 
5
13
  - Initial release
data/Gemfile CHANGED
@@ -5,8 +5,7 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in encuisine.gemspec
6
6
  gemspec
7
7
 
8
+ gem "faraday", "~> 2.2"
8
9
  gem "rake", "~> 13.0"
9
-
10
10
  gem "rspec", "~> 3.0"
11
-
12
11
  gem "rubocop", "~> 1.21"
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
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Cyril Blaecke
3
+ Copyright (c) 2023 Dilolabs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -15,6 +15,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
15
15
  ```ruby
16
16
  require 'encuisine'
17
17
 
18
+ # List all recipes
19
+ Encuisine::Recipe.all
20
+
18
21
  # Search a recipe
19
22
  Encuisine::Recipe.search("Smoothie")
20
23
 
@@ -23,6 +26,15 @@ Encuisine::Recipe.get(id)
23
26
 
24
27
  # Create a recipe
25
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)
26
38
  ```
27
39
 
28
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
@@ -3,6 +3,10 @@
3
3
  module Encuisine
4
4
  class Recipe
5
5
  class << self
6
+ def all
7
+ response = Connection.json.get("#{BASE_URL}/api/v1/recipes")
8
+ end
9
+
6
10
  def get(id)
7
11
  if id
8
12
  response = Connection.json.get("#{BASE_URL}/api/v1/recipes/#{id}")
@@ -11,7 +15,7 @@ module Encuisine
11
15
 
12
16
  def search(query)
13
17
  if query
14
- response = Connection.json.post("#{BASE_URL}/api/v1/recipes/searches") do |request|
18
+ response = Connection.json.get("#{BASE_URL}/api/v1/recipes") do |request|
15
19
  request.params["q"] = query
16
20
  end
17
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Encuisine
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
  end
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
- if Rails.env.production?
9
- DEFAULT_DOMAIN = "api.encuisine.org"
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.1.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: 2022-04-09 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -36,11 +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
43
  - lib/encuisine.rb
43
44
  - lib/encuisine/connection.rb
45
+ - lib/encuisine/food.rb
44
46
  - lib/encuisine/recipe.rb
45
47
  - lib/encuisine/version.rb
46
48
  - sig/encuisine.rbs
@@ -52,7 +54,7 @@ metadata:
52
54
  homepage_uri: https://github.com/encuisineorg/encuisine-ruby
53
55
  source_code_uri: https://github.com/encuisineorg/encuisine-ruby
54
56
  changelog_uri: https://github.com/encuisineorg/encuisine-ruby/CHANGELOG.md
55
- post_install_message:
57
+ post_install_message:
56
58
  rdoc_options: []
57
59
  require_paths:
58
60
  - lib
@@ -67,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
69
  - !ruby/object:Gem::Version
68
70
  version: '0'
69
71
  requirements: []
70
- rubygems_version: 3.3.7
71
- signing_key:
72
+ rubygems_version: 3.4.10
73
+ signing_key:
72
74
  specification_version: 4
73
75
  summary: En Cuisine API wrapper
74
76
  test_files: []