Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solo Project - Golden Square #2245

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 04_solo_project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
twilio.env
1 change: 1 addition & 0 deletions 04_solo_project/.rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
15 changes: 15 additions & 0 deletions 04_solo_project/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# gem "rails"

gem 'rubocop', '~> 1.39'

gem 'rspec', '~> 3.12'

gem 'twilio-ruby', '~> 5.73'

gem 'dotenv', '~> 2.8'

gem "twilio_mock", "~> 0.4.6"
79 changes: 79 additions & 0 deletions 04_solo_project/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
crack (0.4.5)
rexml
diff-lcs (1.5.0)
dotenv (2.8.1)
faraday (2.7.0)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
hashdiff (1.0.1)
json (2.6.2)
jwt (2.5.0)
nokogiri (1.13.9-arm64-darwin)
racc (~> 1.4)
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
public_suffix (5.0.0)
racc (1.6.0)
rainbow (3.1.1)
regexp_parser (2.6.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.39.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
twilio-ruby (5.73.2)
faraday (>= 0.9, < 3.0)
jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0)
twilio_mock (0.4.6)
twilio-ruby (~> 5.3, >= 5.3.1)
webmock (~> 3.0, >= 2)
unicode-display_width (2.3.0)
webmock (3.18.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)

PLATFORMS
arm64-darwin-21

DEPENDENCIES
dotenv (~> 2.8)
rspec (~> 3.12)
rubocop (~> 1.39)
twilio-ruby (~> 5.73)
twilio_mock (~> 0.4.6)

BUNDLED WITH
2.3.23
48 changes: 48 additions & 0 deletions 04_solo_project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Solo Project

Here is a project to test your golden square skills overall:

> As a customer
> So that I can check if I want to order something
> I would like to see a list of dishes with prices.
>
> As a customer
> So that I can order the meal I want
> I would like to be able to select some number of several available dishes.
>
> As a customer
> So that I can verify that my order is correct
> I would like to see an itemised receipt with a grand total.

Use the `twilio-ruby` gem to implement this next one. You will need to use
doubles too.

> As a customer
> So that I am reassured that my order will be delivered on time
> I would like to receive a text such as "Thank you! Your order was placed and
> will be delivered before 18:52" after I have ordered.

Fair warning: if you push your Twilio API Key to a public Github repository,
anyone will be able to see and use it. What are the security implications of
that? How will you keep that information out of your repository?

A: I plan on storing the private key in twilio.env and adding twilio.env to the .gitignore file - I should be able to access the key in the application files with something like private_key = ENV['TWILIO_KEY']
Here is a good [article](https://medium.com/coffee-and-codes/the-simplest-and-powerful-ruby-gem-dotenv-74d64cbc5d5d) on the gem dotenv

## Getting started

`git clone https://github.com/jillwones/Golden-Square-Challenges.git`
`bundle install`
`add a twilio.env file to the root of 04_solo_project and inside it write:`
`export TWILIO_ACCOUNT_SID=xxxxxxxxxxxxxxxxxxxxxxxxxxxx`
`export TWILIO_AUTH_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxx`

If you want the confirmation text to go to your phone number and not mine please change the default number in the send_text method in FinishMyOrder class to your phone number.

## Usage

`ruby lib/run_on_terminal.rb`

## Running tests

`rspec`
Loading