vino_suggest 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +62 -0
- data/LICENSE.txt +21 -0
- data/README.md +226 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/.DS_Store +0 -0
- data/lib/Wine-List-March2020.csv +19 -0
- data/lib/Wine-Sales.csv +7 -0
- data/lib/vino_suggest.rb +128 -0
- data/lib/vino_suggest/version.rb +3 -0
- data/lib/wine_classes.rb +14 -0
- data/vino_suggest.gemspec +27 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1fca9c7ebcd95c8ef19b28a1edf1b7beaba4c0a743792b1f225dfda0d2bf372d
|
4
|
+
data.tar.gz: 877791f0d1f12cc7b023785313d374faa440ccc7820342e8abb13024b31cc1c2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 27c918355a314c0270d89f6a03f9a9ee95b37e458c49fe2e6cce533d744a0a013f2ea8f611be43d73c637be403a0df7d9847792d11c48bd1574e2457869d552a
|
7
|
+
data.tar.gz: b83fd91faaac451d397b08fa61a24978e82f7dadcec316fb624c79622c1b68bcf80cdb15c1d6a6840561d3e277c68a860d47e333f037e0bc3f03b21b562fb834
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at emma.bindi@outlook.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vino_suggest (0.1.0)
|
5
|
+
artii (~> 2.1.2)
|
6
|
+
colorize (~> 0.8.1)
|
7
|
+
rubocop (~> 0.80.1)
|
8
|
+
terminal-table (~> 1.8.0)
|
9
|
+
tty-prompt (~> 0.21.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
artii (2.1.2)
|
15
|
+
ast (2.4.0)
|
16
|
+
colorize (0.8.1)
|
17
|
+
equatable (0.6.1)
|
18
|
+
jaro_winkler (1.5.4)
|
19
|
+
necromancer (0.5.1)
|
20
|
+
parallel (1.19.1)
|
21
|
+
parser (2.7.0.4)
|
22
|
+
ast (~> 2.4.0)
|
23
|
+
pastel (0.7.3)
|
24
|
+
equatable (~> 0.6)
|
25
|
+
tty-color (~> 0.5)
|
26
|
+
rainbow (3.0.0)
|
27
|
+
rake (12.3.3)
|
28
|
+
rexml (3.2.4)
|
29
|
+
rubocop (0.80.1)
|
30
|
+
jaro_winkler (~> 1.5.1)
|
31
|
+
parallel (~> 1.10)
|
32
|
+
parser (>= 2.7.0.1)
|
33
|
+
rainbow (>= 2.2.2, < 4.0)
|
34
|
+
rexml
|
35
|
+
ruby-progressbar (~> 1.7)
|
36
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
37
|
+
ruby-progressbar (1.10.1)
|
38
|
+
terminal-table (1.8.0)
|
39
|
+
unicode-display_width (~> 1.1, >= 1.1.1)
|
40
|
+
tty-color (0.5.1)
|
41
|
+
tty-cursor (0.7.1)
|
42
|
+
tty-prompt (0.21.0)
|
43
|
+
necromancer (~> 0.5.0)
|
44
|
+
pastel (~> 0.7.0)
|
45
|
+
tty-reader (~> 0.7.0)
|
46
|
+
tty-reader (0.7.0)
|
47
|
+
tty-cursor (~> 0.7)
|
48
|
+
tty-screen (~> 0.7)
|
49
|
+
wisper (~> 2.0.0)
|
50
|
+
tty-screen (0.7.1)
|
51
|
+
unicode-display_width (1.6.1)
|
52
|
+
wisper (2.0.1)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
rake (~> 12.0)
|
59
|
+
vino_suggest!
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Emma Bindi
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# VinoSuggest
|
2
|
+
|
3
|
+
### Link to Source Code Repository:
|
4
|
+
|
5
|
+
https://github.com/emmabindi/wine-terminal-app.git
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
# Software Development Plan
|
10
|
+
|
11
|
+
## *Purpose*
|
12
|
+
|
13
|
+
"Em's Wine Selection Assistant" is a terminal app design to assist user's with the decision making process of identifying and selecting a bottle of wine to purchase from the list of available options, within their budget and according to their preference.
|
14
|
+
|
15
|
+
This app is designed to increase efficiency in decision making by filtering the available wine bottles to a suitable selection for the user. The app is also designed to ensure only users of a legal drinking age can participate.
|
16
|
+
|
17
|
+
The target audience for this app is wine lovers who are of a legal drinking age in Australia.
|
18
|
+
|
19
|
+
A member of the target audience will use it by installing the required gems and running the ruby file.
|
20
|
+
The user will then interact with the application by inputting their selections upon command into the terminal and following prompts.
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
## *Features*
|
25
|
+
|
26
|
+
**1. Age Filter**
|
27
|
+
|
28
|
+
The application will utilise logic to provide control flow based on the condition of the user being of a legal drinking age in Australia. This feature should allow a retry attempt if user inputs data other than an integer.
|
29
|
+
This feature will also present a sorry message and exit to the users under the legal drinking age. As well as present a sorry message and exit for users over a reasonable age for consuming alcohol such as 140 years of age.
|
30
|
+
|
31
|
+
**2. Budget Filter**
|
32
|
+
|
33
|
+
The application will provide a selection of budget ranges for the user to choose from. This filter will then only suggest wine bottles to purchase if they fall within the user's budget. If user input does not match the budget options presented, a notification will display to let the user know they need to start the selection process from the beginning.
|
34
|
+
And/or TTY-prompt gem will be utilised to ensure user can only select from the available options and no input errors occur.
|
35
|
+
|
36
|
+
**3. Wine Preference**
|
37
|
+
|
38
|
+
The application will take input from the user on which wine category they would like to select from. The application will present a list of categories available to choose from: Sparkling, White, Rose, Orange, Red and Surprise and following on from the user's choice of one of these categories will then present wine bottles available which fall into this category only.
|
39
|
+
If user input does not match the categories presented, an notification will present to let the user know they need to start the selection process from the beginning. And/or TTY-prompt gem will be utilised to ensure user can only select from the available options and no input errors occur.
|
40
|
+
|
41
|
+
**4. Wine Suggestion List**
|
42
|
+
|
43
|
+
Following on from obtaining the user's inputs of age, budget and preference, the application will then provide a list for the user to view of the suitable wine offerings available with additional information such as producers name, the country of origin, region, grape variety and sale price. The suggestion list will be colored in blue so it stands out.
|
44
|
+
|
45
|
+
**5. Wine Selection**
|
46
|
+
|
47
|
+
The application will then accept a decision from the user to choose a particular bottle from the suggested list.
|
48
|
+
It will also allow the user to reject the offered wines and re-start the selection process if user changes their mind or are unhappy with the suggestion.
|
49
|
+
|
50
|
+
**6. Wine Sales Log**
|
51
|
+
|
52
|
+
The application will have an in built function to output the user selections to a csv file which will record the wines selected and sales price. This output will continuously add the user selections and create a log of sales so that dollar totals can be calculated and used.
|
53
|
+
|
54
|
+
|
55
|
+
---
|
56
|
+
|
57
|
+
### User Interaction and Experience
|
58
|
+
|
59
|
+
|
60
|
+
The user will interact with this application by running the ruby program from their terminal. From the initialisation of the app, the terminal window will display prompts and menu options to the user.
|
61
|
+
|
62
|
+
These prompts and messages will direct and guide the user through the application so that the features are accessed/utilised.
|
63
|
+
|
64
|
+
Using the TTY-prompt gem will reduce the likelihood of user input created errors by limiting and controlling user inputs to selections from a pre-defined menu only. The use of the gem TTY prompt allowed me to remove the manual error handling code such as converting strings to integers, capitalising input to match menu options etc.
|
65
|
+
|
66
|
+
---
|
67
|
+
|
68
|
+
|
69
|
+
### Control Flow Diagram
|
70
|
+
|
71
|
+
|
72
|
+
![Control Flow Diagram - Wine Selection App](docs/Wine_Selection_App_Activity_Diagram.png)
|
73
|
+
|
74
|
+
---
|
75
|
+
|
76
|
+
### Implementation Plan
|
77
|
+
|
78
|
+
For this application I utilised Trello project management software.
|
79
|
+
The link to access my Trello board "FastTrack Terminal" is below:
|
80
|
+
|
81
|
+
https://trello.com/invite/b/rYZ1aRYW/8158415533b26771d5aca5b295ca5421/fasttrack-terminal
|
82
|
+
|
83
|
+
Snapshots of Trello Board in Progress:
|
84
|
+
|
85
|
+
![Trello Board Photo 1](docs/Trello-snippet1.png)
|
86
|
+
![Trellot Board Photo 2](docs/Trello-snippet2.png)
|
87
|
+
|
88
|
+
**The general / overarching priority ranking that I followed was:**
|
89
|
+
|
90
|
+
High Priority:
|
91
|
+
- create or locate data set of wine data for selection
|
92
|
+
- create class for Wine
|
93
|
+
- create objects for wines in my data set ("wine list")
|
94
|
+
- create display with welcome message
|
95
|
+
- create function to obtain users age. Control flow based on age parameters
|
96
|
+
- testing and implement error handling for age function
|
97
|
+
|
98
|
+
Medium Priority/or Dependant Tasks:
|
99
|
+
- create function to display budget options and obtain user selection
|
100
|
+
- testing and implement error handling for budget selection
|
101
|
+
- ensure budget selection creates a new array with the wines within the budget parameters only
|
102
|
+
- create function to display wine type options and obtain user selection
|
103
|
+
- testing and implement error handling for wine type selection
|
104
|
+
- display the suggested wine to the user based on budget and type
|
105
|
+
- make the above display user friendly and conversational
|
106
|
+
- present option to user to accept the suggested wine or reject it and restart the process
|
107
|
+
- test the accept/reject wine suggestion function
|
108
|
+
- create csv file to record sales log with wine name and price
|
109
|
+
- read csv file and push selected wine to the file
|
110
|
+
- test wine sales csv document push and ensure selections are appended to existing data not overwriting so a sales log/history is developed providing $ totals
|
111
|
+
|
112
|
+
Low Priority / Final Tasks
|
113
|
+
- add artwork, font and colours to the menu options and text displays to make the interaction with teriminal more fun
|
114
|
+
- add methods to run greeting/messages in artistic formats
|
115
|
+
- perform testing of all functions and implement error handling techniques
|
116
|
+
|
117
|
+
---
|
118
|
+
|
119
|
+
## HELP Documentation
|
120
|
+
|
121
|
+
### Installation Instructions
|
122
|
+
|
123
|
+
**1. Install ruby**
|
124
|
+
|
125
|
+
Mac OS:
|
126
|
+
Recommend to utilise package manager called "Homebrew"
|
127
|
+
|
128
|
+
Run the following command in terminal:
|
129
|
+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
130
|
+
|
131
|
+
Then utilise the version manager rbenv to install Ruby:
|
132
|
+
|
133
|
+
Run the following commnand in terminal:
|
134
|
+
|
135
|
+
```
|
136
|
+
brew install rbenv
|
137
|
+
```
|
138
|
+
|
139
|
+
Set up rbenv in your shell by running the following command and following the printed instructions
|
140
|
+
|
141
|
+
```
|
142
|
+
rbenv init
|
143
|
+
```
|
144
|
+
|
145
|
+
Close terminal window and re-open for changes to take effect.
|
146
|
+
|
147
|
+
Run the following command in terminal:
|
148
|
+
|
149
|
+
```
|
150
|
+
rbenv install 2.7.0
|
151
|
+
```
|
152
|
+
|
153
|
+
*(For non-Mac users, please Google for 'how-to' instructions or preferably utilise a virtual machine)*
|
154
|
+
|
155
|
+
**2. Install gems**
|
156
|
+
|
157
|
+
Run the following command in terminal:
|
158
|
+
|
159
|
+
```
|
160
|
+
gem install colorize
|
161
|
+
gem install artii
|
162
|
+
gem install tty-prompt
|
163
|
+
gem install terminal-table
|
164
|
+
```
|
165
|
+
|
166
|
+
**3. Type irb into terminal**
|
167
|
+
|
168
|
+
```
|
169
|
+
irb
|
170
|
+
```
|
171
|
+
|
172
|
+
**4. Run the ruby file**
|
173
|
+
|
174
|
+
```
|
175
|
+
ruby wine.rb
|
176
|
+
```
|
177
|
+
|
178
|
+
---
|
179
|
+
|
180
|
+
### Dependencies
|
181
|
+
|
182
|
+
This application has the below dependencies which are already within the gem file:
|
183
|
+
|
184
|
+
- colorize
|
185
|
+
- TTY-prompt
|
186
|
+
- artii
|
187
|
+
- terminal-table
|
188
|
+
- rubocop
|
189
|
+
|
190
|
+
|
191
|
+
---
|
192
|
+
|
193
|
+
### System/Hardware Requirements
|
194
|
+
|
195
|
+
There are no specific hardware requirements to run the gem.
|
196
|
+
|
197
|
+
---
|
198
|
+
|
199
|
+
### Instructions: How To Use the Application
|
200
|
+
|
201
|
+
To run this wine selection assistant:
|
202
|
+
|
203
|
+
1. open the terminal window on your computer.
|
204
|
+
2. enter "ruby wine.rb" into your terminal
|
205
|
+
3. from this point, a welcome message will appear and the application will begin to guide you through the selection process
|
206
|
+
4. follow the prompts and enter your age in years (full numbers only ie. 27 if you are 27 years old)
|
207
|
+
5. if you are over 18 years old, a menu will appear offering you budget levels to choose from. Use the arrow up and down keys on your keyboard to make your selection and then press enter
|
208
|
+
6. another menu and message will appear offering you the choice of which type of wine you would like suggested to you. Use the up and down arrow keys to make your selection and then press enter. If you would like the computer to 'surprise' you choose "surprise" instead.
|
209
|
+
7. the application will then display a wine to you within the parameters you had chosen in prior steps. Review this wine recommendation.
|
210
|
+
8. another menu will appear, using the up and down arrow keys, select whether you are happy with the suggested wine or if you would like to restart the process. If you would like to restart the above steps will be carried out again.
|
211
|
+
9. Once you select 'happy with the choice', a goodbye message will be received and the application will record the wine sale in an external csv file.
|
212
|
+
10. Enjoy!
|
213
|
+
|
214
|
+
|
215
|
+
## Contributing
|
216
|
+
|
217
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vino_suggest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/vino_suggest/blob/master/CODE_OF_CONDUCT.md).
|
218
|
+
|
219
|
+
|
220
|
+
## License
|
221
|
+
|
222
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
223
|
+
|
224
|
+
## Code of Conduct
|
225
|
+
|
226
|
+
Everyone interacting in the VinoSuggest project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vino_suggest/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vino_suggest"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Type,Name,Budget,Sale_Price,Producer,Country_of_Origin,Grape_Variety,Region,
|
2
|
+
Sparkling,Range Life Prosecco NV,Budget,$22.00,Range Life,Australia,Glera,King Valley,
|
3
|
+
Sparkling,Atmospheres NV,Mid-Range,$45.00,Jo Landron,France,"Chardonnay, Folle Blanc, Pinot Noir",Muscadet,
|
4
|
+
Sparkling,Baron Jacques Blanc de Blanc,Premium,$52.00,Baron Jacques,France,Chardonnay,Burgundy ,
|
5
|
+
White,Eden Valley No 4,Budget,$24.00,RieslingFreak,Australia,Riesling,Eden Valley,
|
6
|
+
White,Ouille Savagnin,Mid-Range,$35.00,Scintilla Wines,Australia,Savagnin,Fleurieu Peninsiula,
|
7
|
+
White,Exogyra Virgula,Premium,$74.00,Goisot,France,Cepage Sauvignon Blanc,Bourgogne,
|
8
|
+
Rose,Mallaluka Rose,Budget,$23.00,Mallaluka,Australia,"Sangiovese, Viognier",Canberra,
|
9
|
+
Rose,Summer Snowflake,Mid-Range,$44.00,Kunoh Wines,New Zealand,"Pinot Gris, Chardonnay, Sauvignon Blanc, Gerwurztraminer, Riesling",Nelson,
|
10
|
+
Rose,Grain de Folie Rose,Premium,$56.00,Domaine Mamaruta,France,Syrah,Vin de France,
|
11
|
+
Orange,Boomtown Amber,Budget,$24.00,Boomtown,Australia,Riesling & Fiano,Central Victoria,
|
12
|
+
Orange,Libiamo,Mid-Range,$34.00,Millton Vineyards,New Zealand,Field Blend,Gisborne,
|
13
|
+
Orange,Emma,Premium,$59.00,Farnea di Marco Buratti,Italy,Muscat,Padua,
|
14
|
+
Red,Poliphonia ,Budget,$24.50,Pheasant’s Tears,Georgia,417 Variety Field Blend,Caucasus,
|
15
|
+
Red,Onannon Noir,Mid-Range,$42.00,Onannon,Australia,Pinot Noir,Mornington Peninsula,
|
16
|
+
Red,Farr Rising,Premium,$54.00,Nick Farr,Australia,Shiraz,Geelong,
|
17
|
+
Surprise,Minim Hitch,Budget,$24.00,Minim Wines,Australia,Sangiovese & Nero D’Avola,Heathcote,
|
18
|
+
Surprise,Moonlit Forrest,Mid-Range,$34.00,Jayden Ong,Australia,Pinot Gris & Pinot Noir,Victoria,
|
19
|
+
Surprise,Hochkirch Maximus Pinor Noir,Premium,$58.00,Hochkirch,Australia,Pinot Noir ,Henty,
|
data/lib/Wine-Sales.csv
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
"[""Eden Valley No 4"", ""$24.00""]"
|
2
|
+
"[""Baron Jacques Blanc de Blanc"", ""$52.00""]"
|
3
|
+
"[""Moonlit Forrest"", ""$34.00""]"
|
4
|
+
"[""Summer Snowflake"", ""$44.00""]"
|
5
|
+
"[""Onannon Noir"", ""$42.00""]"
|
6
|
+
"[""Libiamo"", ""$34.00""]"
|
7
|
+
"[""Hochkirch Maximus Pinor Noir"", ""$58.00""]"
|
data/lib/vino_suggest.rb
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
require "vino_suggest/version"
|
2
|
+
|
3
|
+
module VinoSuggest
|
4
|
+
class Error < StandardError; end
|
5
|
+
|
6
|
+
require_relative 'wine_classes'
|
7
|
+
require 'tty-prompt'
|
8
|
+
require 'csv'
|
9
|
+
require 'colorize'
|
10
|
+
require 'artii'
|
11
|
+
require 'terminal-table'
|
12
|
+
|
13
|
+
def save_purchase_details(final_selection)
|
14
|
+
CSV.open('./Wine-Sales.csv', 'a') do |csv|
|
15
|
+
csv << [[final_selection[0].name, final_selection[0].sale_price]]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def print_heading(message)
|
20
|
+
a = Artii::Base.new font: 'digital'
|
21
|
+
puts a.asciify(message).colorize(:light_blue)
|
22
|
+
end
|
23
|
+
|
24
|
+
prompt = TTY::Prompt.new
|
25
|
+
|
26
|
+
csv_text = File.read('Wine-List-March2020.csv')
|
27
|
+
csv = CSV.parse(csv_text, headers: true)
|
28
|
+
wine_list = []
|
29
|
+
csv.each do |row|
|
30
|
+
row_data = row.to_hash
|
31
|
+
wine_list.push(Wine.new(row_data['Type'], row_data['Name'], row_data['Budget'], row_data['Sale_Price'], row_data['Producer'], row_data['Country_of_Origin'], row_data['Grape_Variety'], row_data['Region']))
|
32
|
+
end
|
33
|
+
|
34
|
+
# The below code is to collect the user's age and verify that they are over 18 years old and legally allowed to consume alcohol (within Australia)
|
35
|
+
|
36
|
+
begin
|
37
|
+
begin
|
38
|
+
print_heading('Hello')
|
39
|
+
|
40
|
+
puts "
|
41
|
+
... and welcome to Em's Wine Selection Assistant
|
42
|
+
"
|
43
|
+
puts 'Please input your age in years'
|
44
|
+
|
45
|
+
age = gets.chomp
|
46
|
+
age = Integer(age)
|
47
|
+
|
48
|
+
if age < 18
|
49
|
+
puts 'Sorry, you need to be over 18 to use this application'
|
50
|
+
exit
|
51
|
+
elsif age >=110
|
52
|
+
puts 'Sorry, I appreciate your interest, but maybe considering your elderly age it would be best if you avoid alcohol in the best interests of your health'
|
53
|
+
exit
|
54
|
+
elsif age >= 18
|
55
|
+
puts "Thanks, let's continue"
|
56
|
+
puts ''
|
57
|
+
end
|
58
|
+
rescue StandardError
|
59
|
+
puts "Sorry, that didn't work, please enter your age in years using numbers only"
|
60
|
+
retry
|
61
|
+
end
|
62
|
+
|
63
|
+
# the below code is to collect the users budget selection
|
64
|
+
|
65
|
+
budget = prompt.select("Please confirm your budget for this wine selection:
|
66
|
+
|
67
|
+
Budget >$25 | Mid-Range: $25-$50 | Premium: >$50
|
68
|
+
|
69
|
+
",
|
70
|
+
%w[Budget Mid-Range Premium])
|
71
|
+
|
72
|
+
begin
|
73
|
+
if budget != 'Budget' && budget != 'Mid-Range' && budget != 'Premium'
|
74
|
+
raise 'invalid input'
|
75
|
+
end
|
76
|
+
rescue RuntimeError
|
77
|
+
puts "Sorry, that didn't work, please chose either Budget, Mid-Range or Premium from the list of options"
|
78
|
+
retry
|
79
|
+
end
|
80
|
+
|
81
|
+
# the below code begins to filter the wine selected by the user into a new array which will then be displayed to them. First filter is budget and then it moves onto type
|
82
|
+
|
83
|
+
user_wine_selection = wine_list.select do |wine|
|
84
|
+
budget == wine.budget
|
85
|
+
end
|
86
|
+
|
87
|
+
type_selected = prompt.select("Now that we've confirmed your price range. Please confirm your preference for wine today:
|
88
|
+
",
|
89
|
+
%w[Sparkling White Rose Orange Red Surprise])
|
90
|
+
|
91
|
+
puts ''
|
92
|
+
|
93
|
+
final_selection = user_wine_selection.select do |wine|
|
94
|
+
type_selected == wine.type
|
95
|
+
end
|
96
|
+
|
97
|
+
# the below code is to allow for conversational style printing of the wine suggestion
|
98
|
+
|
99
|
+
puts "This is the wine I will suggest today based on your budget and preferences:
|
100
|
+
|
101
|
+
#{final_selection[0].name} by #{final_selection[0].producer} which retails for #{final_selection[0].sale_price}.
|
102
|
+
|
103
|
+
This wine is from #{final_selection[0].region} in #{final_selection[0].country_of_origin} and is made from #{final_selection[0].grape_variety} grapes.
|
104
|
+
".colorize(:light_blue)
|
105
|
+
|
106
|
+
# the below code is to send the user back to the beginning of the process if they are not happy with the suggestion or changed their mind on budget/type
|
107
|
+
|
108
|
+
satisfied = prompt.select("Would you like to accept this suggestion or review the options again and make changes to your preferences?
|
109
|
+
", ["I'm happy with my selection and would like to purchase this wine, cheers!", 'I would like to review the options again'])
|
110
|
+
|
111
|
+
if satisfied != "I'm happy with my selection and would like to purchase this wine, cheers!"
|
112
|
+
raise "Ok we'll start again"
|
113
|
+
end
|
114
|
+
rescue StandardError
|
115
|
+
retry
|
116
|
+
else
|
117
|
+
# The below code is me attempting to list the wine selected into a sales file recording prices
|
118
|
+
puts "
|
119
|
+
Thank you - enjoy your bottle of vino!
|
120
|
+
"
|
121
|
+
|
122
|
+
print_heading('Cheers! Salute! Prost!')
|
123
|
+
puts ""
|
124
|
+
|
125
|
+
save_purchase_details(final_selection)
|
126
|
+
exit
|
127
|
+
end
|
128
|
+
end
|
data/lib/wine_classes.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class Wine
|
2
|
+
attr_accessor :type, :name, :budget, :sale_price, :producer, :country_of_origin, :grape_variety, :region
|
3
|
+
|
4
|
+
def initialize(type, name, budget, sale_price, producer, country_of_origin, grape_variety, region)
|
5
|
+
@type = type
|
6
|
+
@name = name
|
7
|
+
@budget = budget
|
8
|
+
@sale_price = sale_price
|
9
|
+
@producer = producer
|
10
|
+
@country_of_origin = country_of_origin
|
11
|
+
@grape_variety = grape_variety
|
12
|
+
@region = region
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'lib/vino_suggest/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "vino_suggest"
|
5
|
+
spec.version = VinoSuggest::VERSION
|
6
|
+
spec.authors = ["Emma Bindi"]
|
7
|
+
spec.email = ["emma.bindi@outlook.com"]
|
8
|
+
|
9
|
+
spec.summary = "Wine Selection Assistant - Terminal Application."
|
10
|
+
spec.description = "Em's Wine Selection Assistant is a terminal app design to assist user's with the decision making process of identifying and selecting a bottle of wine to purchase from the list of available options, within their budget and according to their preference."
|
11
|
+
spec.homepage = "https://github.com/emmabindi/wine-terminal-app"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
# Specify which files should be added to the gem when it is released.
|
15
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.add_dependency "colorize", "~> 0.8.1"
|
23
|
+
spec.add_dependency "rubocop", "~> 0.80.1"
|
24
|
+
spec.add_dependency "tty-prompt", "~> 0.21.0"
|
25
|
+
spec.add_dependency "terminal-table", "~> 1.8.0"
|
26
|
+
spec.add_dependency "artii", "~> 2.1.2"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vino_suggest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Emma Bindi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colorize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.80.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.80.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tty-prompt
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.21.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.21.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: terminal-table
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: artii
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.1.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.1.2
|
83
|
+
description: Em's Wine Selection Assistant is a terminal app design to assist user's
|
84
|
+
with the decision making process of identifying and selecting a bottle of wine to
|
85
|
+
purchase from the list of available options, within their budget and according to
|
86
|
+
their preference.
|
87
|
+
email:
|
88
|
+
- emma.bindi@outlook.com
|
89
|
+
executables: []
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- ".DS_Store"
|
94
|
+
- ".gitignore"
|
95
|
+
- CODE_OF_CONDUCT.md
|
96
|
+
- Gemfile
|
97
|
+
- Gemfile.lock
|
98
|
+
- LICENSE.txt
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- bin/console
|
102
|
+
- bin/setup
|
103
|
+
- lib/.DS_Store
|
104
|
+
- lib/Wine-List-March2020.csv
|
105
|
+
- lib/Wine-Sales.csv
|
106
|
+
- lib/vino_suggest.rb
|
107
|
+
- lib/vino_suggest/version.rb
|
108
|
+
- lib/wine_classes.rb
|
109
|
+
- vino_suggest.gemspec
|
110
|
+
homepage: https://github.com/emmabindi/wine-terminal-app
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 2.3.0
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubygems_version: 3.1.2
|
130
|
+
signing_key:
|
131
|
+
specification_version: 4
|
132
|
+
summary: Wine Selection Assistant - Terminal Application.
|
133
|
+
test_files: []
|