-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lee Crey
authored and
Lee Crey
committed
Jan 20, 2022
1 parent
3f66155
commit c64bbd0
Showing
80 changed files
with
1,962 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# See https://git-scm.com/docs/gitattributes for more about git attribute files. | ||
|
||
# Mark the database schema as having been generated. | ||
db/schema.rb linguist-generated | ||
|
||
# Mark any vendored files as having been vendored. | ||
vendor/* linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
AllCops: | ||
TargetRubyVersion: 3.0.2 | ||
Exclude: | ||
- 'config.ru' | ||
- 'Rakefile' | ||
- 'config/**/*' | ||
- 'bin/*' | ||
- 'test/**/*' | ||
- 'spec/**/' | ||
- 'db/**/*' | ||
- 'api_test.rb' | ||
|
||
NewCops: enable | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Bundler/OrderedGems: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby-3.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
|
||
ruby '3.0.3' | ||
|
||
gem 'rails', '~> 7.0.0' | ||
gem 'puma', '~> 5.0' | ||
gem 'bcrypt', '~> 3.1.7' | ||
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] | ||
gem 'bootsnap', require: false | ||
gem 'jwt', '~> 2.3' | ||
gem 'pg', '~> 1.2' | ||
gem 'rack-cors', '~> 1.1' | ||
gem 'will_paginate', '~> 3.3' | ||
gem 'active_model_serializers', '~> 0.10.13' | ||
|
||
group :development, :test do | ||
gem 'debug', platforms: %i[mri mingw x64_mingw] | ||
gem 'rdoc' | ||
gem 'rspec-rails' | ||
end | ||
|
||
group :development do | ||
gem 'faker', '~> 2.19' | ||
gem 'sqlite3', '~> 1.4' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
actioncable (7.0.1) | ||
actionpack (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
nio4r (~> 2.0) | ||
websocket-driver (>= 0.6.1) | ||
actionmailbox (7.0.1) | ||
actionpack (= 7.0.1) | ||
activejob (= 7.0.1) | ||
activerecord (= 7.0.1) | ||
activestorage (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
mail (>= 2.7.1) | ||
net-imap | ||
net-pop | ||
net-smtp | ||
actionmailer (7.0.1) | ||
actionpack (= 7.0.1) | ||
actionview (= 7.0.1) | ||
activejob (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
mail (~> 2.5, >= 2.5.4) | ||
net-imap | ||
net-pop | ||
net-smtp | ||
rails-dom-testing (~> 2.0) | ||
actionpack (7.0.1) | ||
actionview (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
rack (~> 2.0, >= 2.2.0) | ||
rack-test (>= 0.6.3) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.2.0) | ||
actiontext (7.0.1) | ||
actionpack (= 7.0.1) | ||
activerecord (= 7.0.1) | ||
activestorage (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
globalid (>= 0.6.0) | ||
nokogiri (>= 1.8.5) | ||
actionview (7.0.1) | ||
activesupport (= 7.0.1) | ||
builder (~> 3.1) | ||
erubi (~> 1.4) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.1, >= 1.2.0) | ||
active_model_serializers (0.10.13) | ||
actionpack (>= 4.1, < 7.1) | ||
activemodel (>= 4.1, < 7.1) | ||
case_transform (>= 0.2) | ||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) | ||
activejob (7.0.1) | ||
activesupport (= 7.0.1) | ||
globalid (>= 0.3.6) | ||
activemodel (7.0.1) | ||
activesupport (= 7.0.1) | ||
activerecord (7.0.1) | ||
activemodel (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
activestorage (7.0.1) | ||
actionpack (= 7.0.1) | ||
activejob (= 7.0.1) | ||
activerecord (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
marcel (~> 1.0) | ||
mini_mime (>= 1.1.0) | ||
activesupport (7.0.1) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 1.6, < 2) | ||
minitest (>= 5.1) | ||
tzinfo (~> 2.0) | ||
bcrypt (3.1.16) | ||
bootsnap (1.10.1) | ||
msgpack (~> 1.2) | ||
builder (3.2.4) | ||
case_transform (0.2) | ||
activesupport | ||
concurrent-ruby (1.1.9) | ||
crass (1.0.6) | ||
debug (1.4.0) | ||
irb (>= 1.3.6) | ||
reline (>= 0.2.7) | ||
diff-lcs (1.5.0) | ||
digest (3.1.0) | ||
erubi (1.10.0) | ||
faker (2.19.0) | ||
i18n (>= 1.6, < 2) | ||
globalid (1.0.0) | ||
activesupport (>= 5.0) | ||
i18n (1.8.11) | ||
concurrent-ruby (~> 1.0) | ||
io-console (0.5.11) | ||
io-wait (0.2.1) | ||
irb (1.4.1) | ||
reline (>= 0.3.0) | ||
jsonapi-renderer (0.2.2) | ||
jwt (2.3.0) | ||
loofah (2.13.0) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.5.9) | ||
mail (2.7.1) | ||
mini_mime (>= 0.1.1) | ||
marcel (1.0.2) | ||
method_source (1.0.0) | ||
mini_mime (1.1.2) | ||
minitest (5.15.0) | ||
msgpack (1.4.2) | ||
net-imap (0.2.3) | ||
digest | ||
net-protocol | ||
strscan | ||
net-pop (0.1.1) | ||
digest | ||
net-protocol | ||
timeout | ||
net-protocol (0.1.2) | ||
io-wait | ||
timeout | ||
net-smtp (0.3.1) | ||
digest | ||
net-protocol | ||
timeout | ||
nio4r (2.5.8) | ||
nokogiri (1.13.1-x86_64-linux) | ||
racc (~> 1.4) | ||
pg (1.2.3) | ||
psych (4.0.3) | ||
stringio | ||
puma (5.5.2) | ||
nio4r (~> 2.0) | ||
racc (1.6.0) | ||
rack (2.2.3) | ||
rack-cors (1.1.1) | ||
rack (>= 2.0.0) | ||
rack-test (1.1.0) | ||
rack (>= 1.0, < 3) | ||
rails (7.0.1) | ||
actioncable (= 7.0.1) | ||
actionmailbox (= 7.0.1) | ||
actionmailer (= 7.0.1) | ||
actionpack (= 7.0.1) | ||
actiontext (= 7.0.1) | ||
actionview (= 7.0.1) | ||
activejob (= 7.0.1) | ||
activemodel (= 7.0.1) | ||
activerecord (= 7.0.1) | ||
activestorage (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
bundler (>= 1.15.0) | ||
railties (= 7.0.1) | ||
rails-dom-testing (2.0.3) | ||
activesupport (>= 4.2.0) | ||
nokogiri (>= 1.6) | ||
rails-html-sanitizer (1.4.2) | ||
loofah (~> 2.3) | ||
railties (7.0.1) | ||
actionpack (= 7.0.1) | ||
activesupport (= 7.0.1) | ||
method_source | ||
rake (>= 12.2) | ||
thor (~> 1.0) | ||
zeitwerk (~> 2.5) | ||
rake (13.0.6) | ||
rdoc (6.4.0) | ||
psych (>= 4.0.0) | ||
reline (0.3.1) | ||
io-console (~> 0.5) | ||
rspec-core (3.10.1) | ||
rspec-support (~> 3.10.0) | ||
rspec-expectations (3.10.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-mocks (3.10.2) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.10.0) | ||
rspec-rails (5.0.2) | ||
actionpack (>= 5.2) | ||
activesupport (>= 5.2) | ||
railties (>= 5.2) | ||
rspec-core (~> 3.10) | ||
rspec-expectations (~> 3.10) | ||
rspec-mocks (~> 3.10) | ||
rspec-support (~> 3.10) | ||
rspec-support (3.10.3) | ||
sqlite3 (1.4.2) | ||
stringio (3.0.1) | ||
strscan (3.0.1) | ||
thor (1.2.1) | ||
timeout (0.2.0) | ||
tzinfo (2.0.4) | ||
concurrent-ruby (~> 1.0) | ||
websocket-driver (0.7.5) | ||
websocket-extensions (>= 0.1.0) | ||
websocket-extensions (0.1.5) | ||
will_paginate (3.3.1) | ||
zeitwerk (2.5.3) | ||
|
||
PLATFORMS | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
active_model_serializers (~> 0.10.13) | ||
bcrypt (~> 3.1.7) | ||
bootsnap | ||
debug | ||
faker (~> 2.19) | ||
jwt (~> 2.3) | ||
pg (~> 1.2) | ||
puma (~> 5.0) | ||
rack-cors (~> 1.1) | ||
rails (~> 7.0.0) | ||
rdoc | ||
rspec-rails | ||
sqlite3 (~> 1.4) | ||
tzinfo-data | ||
will_paginate (~> 3.3) | ||
|
||
RUBY VERSION | ||
ruby 3.0.3p157 | ||
|
||
BUNDLED WITH | ||
2.2.33 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Rails simple blog app | ||
|
||
## Api only | ||
|
||
|
||
``` | ||
Ruby 3.0.+ | ||
Rails 7 | ||
``` | ||
|
||
#### Clone the repo into your local machine | ||
|
||
|
||
* Install Gems | ||
|
||
``` | ||
bundle install | ||
``` | ||
|
||
* Migrate the database | ||
|
||
``` | ||
rake db:migrate | ||
``` | ||
|
||
* Run the server | ||
|
||
``` | ||
rails s | ||
``` | ||
|
||
* Open a new Terminal tab and test the apis | ||
|
||
## APIS | ||
``` | ||
| API | METHOD | DESCRIPTION | ||
============================|===========|================== | ||
| /register | POST | create new account | ||
| /login | POST | get authorization token | ||
| /users | DELETE | delete account | ||
| /posts | GET | get all posts | ||
| /posts | POST | create new post | ||
| /posts/:id | PATCH/PUT | update post content | ||
| /posts/:id | DELETE | delete post | ||
| /posts/:post_id/comments | GET | get all comments of the post | ||
| /posts/:post_id/comments | POST | submit comment for post | ||
| /comments/:id | PATCH/PUT | update comment | ||
| /comments/:id | DELETE | delete comment | ||
------------------------------------------------------------------------- | ||
``` | ||
|
||
### APis and Params | ||
``` | ||
| API | PARAMS | ||
============================|============================= | ||
| /register | user: { first_name, last_name, email, password, password_confirmation } | ||
| /login | user: { email, password } | ||
| /users | confirmation_password | ||
| /posts | post: { title, content }, title is optional | ||
| /posts/:id | post: { content } | ||
| /posts/:post_id/comments | commment: { content } | ||
``` | ||
|
||
Check out [test.sh](api_test.sh) or [test.rb](test.rb) file. | ||
|
||
**NB:** You need to pass authorization token through header to do **post**, **patch** and **delete** operations. Get(read) operation does not need authorization token. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative 'config/application' | ||
|
||
Rails.application.load_tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'faraday' | ||
|
||
# unfinished |
Oops, something went wrong.