yum 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/lib/food.rb +3 -1
- data/lib/request.rb +2 -0
- data/lib/user.rb +2 -2
- data/lib/yum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9805cbd116c92ef85ee5b2239d30c2e9e4ac8f4e
|
4
|
+
data.tar.gz: e3c765b5cfa7160b5434dbf8ddd1b7f96e73c7fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45169e15f76d4e71650d80615ecb304ea94f4f6dcc04376464f631536fdd02e1eb7776f8a52494aa8ce98844fc6b945e9e836a810afc61362a051df99c41df4e
|
7
|
+
data.tar.gz: 61874b24a92d418b16a7aa9d60f3a8b7df12539f051feb125ce6716f5b42fae8a49de6156744e1c7de54016a40d2681c34a39a28de749261716f4cd4aaa3149e
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Yum
|
2
2
|
|
3
|
+
[view the documentation](http://www.rubydoc.info/github/HalfDeadPie/yum-lite-ruby/master/index)
|
4
|
+
|
3
5
|
The Yum is the application with command line interface. The main purpose of this application is to increase your cookings
|
4
6
|
skills, which are represented as the level. All you need to do is to generate the recipe which you like, cook the food, eat it
|
5
7
|
and review it using scale from 0 to 3. The better food you prepare, the more XP points you get. Increasing your XP points leads
|
@@ -7,15 +9,15 @@ to increasing your level. And your level and XP points "unlock" for you more dif
|
|
7
9
|
|
8
10
|
The application uses the Yummly API to access the recipes of the food:
|
9
11
|
|
10
|
-
|
12
|
+
https://developer.yummly.com/
|
11
13
|
|
12
14
|
There is also used the Backendless REST as the storage of users data:
|
13
15
|
|
14
|
-
|
16
|
+
https://backendless.com/docs/rest/doc.html
|
15
17
|
|
16
18
|
Application uses Faraday adapter for executing the requests:
|
17
19
|
|
18
|
-
|
20
|
+
http://www.rubydoc.info/gems/faraday/Faraday/Adapter
|
19
21
|
|
20
22
|
As the new user, you should registrate first with your email and password. After login, you start at level 0 and you
|
21
23
|
are able to generate recipe. So let's cook!
|
@@ -25,6 +27,10 @@ are able to generate recipe. So let's cook!
|
|
25
27
|
You are able to install this gem using this command:
|
26
28
|
|
27
29
|
$ gem install yum
|
30
|
+
|
31
|
+
You can find it on link:
|
32
|
+
|
33
|
+
https://rubygems.org/gems/yum
|
28
34
|
|
29
35
|
Or you can download it from Github and install it this way:
|
30
36
|
|
data/lib/food.rb
CHANGED
@@ -20,7 +20,9 @@ class Food
|
|
20
20
|
# @param food_json [JSON] recipe encapsulated in json from Yummly
|
21
21
|
# @return [String] URL of the image
|
22
22
|
def image_url(food_json)
|
23
|
-
food_json['images'][0]
|
23
|
+
url = food_json['images'][0]['hostedLargeUrl']
|
24
|
+
url = 'Sorry, I can not provide you picture of this food' if url.nil?
|
25
|
+
url
|
24
26
|
end
|
25
27
|
|
26
28
|
# Provides stats of the user in human-readble form
|
data/lib/request.rb
CHANGED
@@ -76,6 +76,8 @@ class Request
|
|
76
76
|
def self.process_response(response)
|
77
77
|
if response.status.eql? 200
|
78
78
|
response.body
|
79
|
+
elsif [414].include? response.status
|
80
|
+
abort('Sorry, I can not find food like this')
|
79
81
|
else
|
80
82
|
abort('I can not communicate with Yummly. Set the YUMMLY_KEY')
|
81
83
|
end
|
data/lib/user.rb
CHANGED
@@ -63,7 +63,7 @@ class User
|
|
63
63
|
|
64
64
|
# Stores the credentials to 'creddentials.csv' to achieve persistence
|
65
65
|
def store_creddentials
|
66
|
-
CSV.open('creddentials.csv', 'w') do |csv|
|
66
|
+
CSV.open(ENV['HOME'] + '/creddentials.csv', 'w') do |csv|
|
67
67
|
csv << [@email, @password]
|
68
68
|
end
|
69
69
|
read_creddentials
|
@@ -72,7 +72,7 @@ class User
|
|
72
72
|
# Reads the credentials from the 'creddentials.csv' and set them
|
73
73
|
def read_creddentials
|
74
74
|
creddentials = []
|
75
|
-
CSV.foreach 'creddentials.csv' do |record|
|
75
|
+
CSV.foreach ENV['HOME'] + '/creddentials.csv' do |record|
|
76
76
|
creddentials << record
|
77
77
|
end
|
78
78
|
@email = creddentials[0][0]
|
data/lib/yum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Stefunko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|