Permalink
Browse files

Merge branch '027/master'

  • Loading branch information...
jordanallain committed Oct 2, 2018
2 parents 524b7dc + 2040f39 commit 450869b69444827cc973f468912c8c3935119698
@@ -57,9 +57,6 @@ Temporary Items
/test/version_tmp/ /test/version_tmp/
/tmp/ /tmp/


# Used by dotenv library to load environment variables.
# .env

## Specific to RubyMotion: ## Specific to RubyMotion:
.dat* .dat*
.repl_history .repl_history
@@ -122,7 +119,6 @@ pickle-email-*.html
# config/secrets.yml # config/secrets.yml


# dotenv # dotenv
# TODO Comment out this rule if environment variables can be committed
.env .env


## Environment normalization: ## Environment normalization:
@@ -147,5 +143,3 @@ bower.json # same
.byebug_history .byebug_history


# End of https://www.gitignore.io/api/rails # End of https://www.gitignore.io/api/rails
.env
.env
@@ -8,7 +8,7 @@ gem 'bcrypt', '~> 3.1.11'
gem 'pg', '~> 0.21' gem 'pg', '~> 0.21'
gem 'puma', '~> 3.11.2' gem 'puma', '~> 3.11.2'
gem 'rack-cors', '~> 1.0.2', require: 'rack/cors' gem 'rack-cors', '~> 1.0.2', require: 'rack/cors'
gem 'rails', '~> 5.1.3' gem 'rails', '~> 5.2.1'


group :development, :test do group :development, :test do
gem 'byebug', '~> 10.0.0', platform: :mri gem 'byebug', '~> 10.0.0', platform: :mri
@@ -1,25 +1,25 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.1.4) actioncable (5.2.1)
actionpack (= 5.1.4) actionpack (= 5.2.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (~> 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.1.4) actionmailer (5.2.1)
actionpack (= 5.1.4) actionpack (= 5.2.1)
actionview (= 5.1.4) actionview (= 5.2.1)
activejob (= 5.1.4) activejob (= 5.2.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.1.4) actionpack (5.2.1)
actionview (= 5.1.4) actionview (= 5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
rack (~> 2.0) rack (~> 2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.1.4) actionview (5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
@@ -29,63 +29,70 @@ GEM
activemodel (>= 4.1, < 6) activemodel (>= 4.1, < 6)
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
activejob (5.1.4) activejob (5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.1.4) activemodel (5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
activerecord (5.1.4) activerecord (5.2.1)
activemodel (= 5.1.4) activemodel (= 5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
arel (~> 8.0) arel (>= 9.0)
activesupport (5.1.4) activestorage (5.2.1)
actionpack (= 5.2.1)
activerecord (= 5.2.1)
marcel (~> 0.3.1)
activesupport (5.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
arel (8.0.0) arel (9.0.0)
ast (2.4.0) ast (2.4.0)
bcrypt (3.1.11) bcrypt (3.1.12)
builder (3.2.3) builder (3.2.3)
byebug (10.0.0) byebug (10.0.2)
case_transform (0.2) case_transform (0.2)
activesupport activesupport
coderay (1.1.2) coderay (1.1.2)
concurrent-ruby (1.0.5) concurrent-ruby (1.0.5)
crass (1.0.3) crass (1.0.4)
diff-lcs (1.3) diff-lcs (1.3)
dotenv (2.2.1) dotenv (2.2.2)
dotenv-rails (2.2.1) dotenv-rails (2.2.2)
dotenv (= 2.2.1) dotenv (= 2.2.2)
railties (>= 3.2, < 5.2) railties (>= 3.2, < 6.0)
erubi (1.7.0) erubi (1.7.1)
ffi (1.9.21) ffi (1.9.25)
globalid (0.4.1) globalid (0.4.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
i18n (0.9.5) i18n (1.1.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
jsonapi-renderer (0.2.0) jsonapi-renderer (0.2.0)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7) rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2) ruby_dep (~> 1.2)
loofah (2.2.0) loofah (2.2.2)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.0) mail (2.7.0)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.0) method_source (0.9.0)
mini_mime (1.0.0) mimemagic (0.3.2)
mini_mime (1.0.1)
mini_portile2 (2.3.0) mini_portile2 (2.3.0)
minitest (5.11.3) minitest (5.11.3)
nio4r (2.2.0) nio4r (2.3.1)
nokogiri (1.8.2) nokogiri (1.8.4)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
parallel (1.12.1) parallel (1.12.1)
parser (2.4.0.2) parser (2.5.1.2)
ast (~> 2.3) ast (~> 2.4.0)
pg (0.21.0) pg (0.21.0)
powerpack (0.1.1) powerpack (0.1.2)
pry (0.11.3) pry (0.11.3)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.9.0) method_source (~> 0.9.0)
@@ -94,42 +101,43 @@ GEM
pry (~> 0.10) pry (~> 0.10)
pry-rails (0.3.6) pry-rails (0.3.6)
pry (>= 0.10.4) pry (>= 0.10.4)
puma (3.11.2) puma (3.11.4)
rack (2.0.4) rack (2.0.5)
rack-cors (1.0.2) rack-cors (1.0.2)
rack-test (0.8.2) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.1.4) rails (5.2.1)
actioncable (= 5.1.4) actioncable (= 5.2.1)
actionmailer (= 5.1.4) actionmailer (= 5.2.1)
actionpack (= 5.1.4) actionpack (= 5.2.1)
actionview (= 5.1.4) actionview (= 5.2.1)
activejob (= 5.1.4) activejob (= 5.2.1)
activemodel (= 5.1.4) activemodel (= 5.2.1)
activerecord (= 5.1.4) activerecord (= 5.2.1)
activesupport (= 5.1.4) activestorage (= 5.2.1)
activesupport (= 5.2.1)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.1.4) railties (= 5.2.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3) rails-dom-testing (2.0.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
nokogiri (>= 1.6) nokogiri (>= 1.6)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.4)
loofah (~> 2.0) loofah (~> 2.2, >= 2.2.2)
rails_12factor (0.0.3) rails_12factor (0.0.3)
rails_serve_static_assets rails_serve_static_assets
rails_stdout_logging rails_stdout_logging
rails_serve_static_assets (0.0.5) rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5) rails_stdout_logging (0.0.5)
railties (5.1.4) railties (5.2.1)
actionpack (= 5.1.4) actionpack (= 5.2.1)
activesupport (= 5.1.4) activesupport (= 5.2.1)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.19.0, < 2.0)
rainbow (3.0.0) rainbow (3.0.0)
rake (12.3.0) rake (12.3.1)
rb-fsevent (0.10.2) rb-fsevent (0.10.3)
rb-inotify (0.9.10) rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2) ffi (>= 0.5.0, < 2)
rspec-core (3.7.1) rspec-core (3.7.1)
@@ -156,13 +164,13 @@ GEM
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0) ruby-progressbar (1.10.0)
ruby_dep (1.5.0) ruby_dep (1.5.0)
spring (2.0.2) spring (2.0.2)
activesupport (>= 4.2) activesupport (>= 4.2)
spring-commands-rspec (1.0.4) spring-commands-rspec (1.0.4)
spring (>= 0.9.1) spring (>= 0.9.1)
sprockets (3.7.1) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.1) sprockets-rails (3.2.1)
@@ -173,8 +181,8 @@ GEM
thread_safe (0.3.6) thread_safe (0.3.6)
tzinfo (1.2.5) tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unicode-display_width (1.3.0) unicode-display_width (1.4.0)
websocket-driver (0.6.5) websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0) websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3) websocket-extensions (0.1.3)


@@ -193,7 +201,7 @@ DEPENDENCIES
pry-rails (~> 0.3.6) pry-rails (~> 0.3.6)
puma (~> 3.11.2) puma (~> 3.11.2)
rack-cors (~> 1.0.2) rack-cors (~> 1.0.2)
rails (~> 5.1.3) rails (~> 5.2.1)
rails_12factor (~> 0.0.3) rails_12factor (~> 0.0.3)
rspec-rails (~> 3.7.2) rspec-rails (~> 3.7.2)
rubocop (~> 0.52.1) rubocop (~> 0.52.1)
@@ -63,7 +63,7 @@ Install with `bundle install`.


This template follows the standard project structure in Rails. This template follows the standard project structure in Rails.


`curl` command scripts are stored in [`scripts`](scripts) with names that `curl` command scripts are stored in [`curl-scripts`](curl-scripts) with names that
correspond to API actions. correspond to API actions.


User authentication is built-in. User authentication is built-in.
@@ -73,22 +73,19 @@ User authentication is built-in.
Developers should run these often! Developers should run these often!


- `bin/rails routes` lists the endpoints available in your API. - `bin/rails routes` lists the endpoints available in your API.
- `bin/rails test` runs automated tests. - `bin/rspec spec` runs automated tests.
- `bin/rails console` opens a REPL that pre-loads the API. - `bin/rails console` opens a REPL that pre-loads the API.
- `bin/rails db` opens your database client and loads the correct database. - `bin/rails db` opens your database client and loads the correct database.
- `bin/rails server` starts the API. - `bin/rails server` starts the API.
- `scripts/*.sh` run various `curl` commands to test the API. See below. - `curl-scripts/*.sh` run various `curl` commands to test the API. See below.

<!-- TODO - `rake nag` checks your code style. -->
<!-- TODO - `rake lint` checks your code for syntax errors. -->


## API ## API


Use this as the basis for your own API documentation. Add a new third-level Use this as the basis for your own API documentation. Add a new third-level
heading for your custom entities, and follow the pattern provided for the heading for your custom entities, and follow the pattern provided for the
built-in user authentication documentation. built-in user authentication documentation.


Scripts are included in [`scripts`](scripts) to test built-in actions. Add your Scripts are included in [`curl-scripts`](curl-scripts) to test built-in actions. Add your
own scripts to test your custom API. As an alternative, you can write automated own scripts to test your custom API. As an alternative, you can write automated
tests in RSpec to test your API. tests in RSpec to test your API.


@@ -120,7 +117,7 @@ curl http://localhost:4741/sign-up \
``` ```


```sh ```sh
EMAIL=ava@bob.com PASSWORD=hannah scripts/sign-up.sh EMAIL=ava@bob.com PASSWORD=hannah curl-scripts/auth/sign-up.sh
``` ```


Response: Response:
@@ -155,7 +152,7 @@ curl http://localhost:4741/sign-in \
``` ```


```sh ```sh
EMAIL=ava@bob.com PASSWORD=hannah scripts/sign-in.sh EMAIL=ava@bob.com PASSWORD=hannah curl-scripts/auth/sign-in.sh
``` ```


Response: Response:
@@ -190,7 +187,7 @@ curl --include --request PATCH "http://localhost:4741/change-password" \
``` ```


```sh ```sh
OLDPW='hannah' NEWPW='elle' TOKEN='BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f' sh scripts/change-password.sh OLDPW='hannah' NEWPW='elle' TOKEN='BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f' sh curl-scripts/auth/change-password.sh
``` ```


Response: Response:
@@ -211,7 +208,7 @@ curl http://localhost:4741/sign-out \
``` ```


```sh ```sh
TOKEN='BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f' sh scripts/sign-out.sh TOKEN='BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f' sh curl-scripts/auth/sign-out.sh
``` ```


Response: Response:
@@ -240,7 +237,7 @@ curl http://localhost:4741/users \
``` ```


```sh ```sh
TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/users.sh TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f curl-scripts/users.sh
``` ```


Response: Response:
@@ -273,7 +270,7 @@ curl --include --request GET http://localhost:4741/users/$ID \
``` ```


```sh ```sh
ID=2 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/user.sh ID=2 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f curl-scripts/user.sh
``` ```


Response: Response:
@@ -310,7 +307,7 @@ curl "http://localhost:4741/users/${ID}" \
```sh ```sh
ID=1 TOKEN="BAhJIiU1NGNlYjRmMjBhM2NkZTZiNzk1MGNiYmZiYWMyY2U4MwY6BkVG--ddb1e16af0e05921aa56d771e4a2f816f2a1d46e" ID=1 TOKEN="BAhJIiU1NGNlYjRmMjBhM2NkZTZiNzk1MGNiYmZiYWMyY2U4MwY6BkVG--ddb1e16af0e05921aa56d771e4a2f816f2a1d46e"
EMAIL=mike@m EMAIL=mike@m
sh scripts/users/user-update.sh sh curl-scripts/users/user-update.sh
``` ```


Response: Response:
Oops, something went wrong.

0 comments on commit 450869b

Please sign in to comment.