Skip to content
This repository was archived by the owner on Aug 8, 2019. It is now read-only.

Commit ff5a488

Browse files
author
condef5
committed
Add api
1 parent 76d9ac3 commit ff5a488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1014
-0
lines changed

api/.rspec

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--require spec_helper

api/.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.6.1

api/Gemfile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
source 'https://rubygems.org'
2+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3+
4+
ruby '2.6.1'
5+
6+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
7+
gem 'rails', '~> 5.2.3'
8+
# Use sqlite3 as the database for Active Record
9+
gem 'sqlite3'
10+
# Use Puma as the app server
11+
gem 'puma', '~> 3.11'
12+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
13+
# gem 'jbuilder', '~> 2.5'
14+
# Use Redis adapter to run Action Cable in production
15+
# gem 'redis', '~> 4.0'
16+
# Use ActiveModel has_secure_password
17+
# gem 'bcrypt', '~> 3.1.7'
18+
19+
# Use ActiveStorage variant
20+
# gem 'mini_magick', '~> 4.8'
21+
22+
# Use Capistrano for deployment
23+
# gem 'capistrano-rails', group: :development
24+
25+
# Reduces boot times through caching; required in config/boot.rb
26+
gem 'bootsnap', '>= 1.1.0', require: false
27+
28+
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
29+
gem 'rack-cors'
30+
31+
group :development, :test do
32+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
33+
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
34+
end
35+
36+
group :development do
37+
gem 'listen', '>= 3.0.5', '< 3.2'
38+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
39+
gem 'spring'
40+
gem 'spring-watcher-listen', '~> 2.0.0'
41+
end
42+
43+
44+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
45+
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
46+
gem 'active_model_serializers'
47+
gem 'rspec-rails'

api/Gemfile.lock

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (5.2.3)
5+
actionpack (= 5.2.3)
6+
nio4r (~> 2.0)
7+
websocket-driver (>= 0.6.1)
8+
actionmailer (5.2.3)
9+
actionpack (= 5.2.3)
10+
actionview (= 5.2.3)
11+
activejob (= 5.2.3)
12+
mail (~> 2.5, >= 2.5.4)
13+
rails-dom-testing (~> 2.0)
14+
actionpack (5.2.3)
15+
actionview (= 5.2.3)
16+
activesupport (= 5.2.3)
17+
rack (~> 2.0)
18+
rack-test (>= 0.6.3)
19+
rails-dom-testing (~> 2.0)
20+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
21+
actionview (5.2.3)
22+
activesupport (= 5.2.3)
23+
builder (~> 3.1)
24+
erubi (~> 1.4)
25+
rails-dom-testing (~> 2.0)
26+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
27+
active_model_serializers (0.10.9)
28+
actionpack (>= 4.1, < 6)
29+
activemodel (>= 4.1, < 6)
30+
case_transform (>= 0.2)
31+
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
32+
activejob (5.2.3)
33+
activesupport (= 5.2.3)
34+
globalid (>= 0.3.6)
35+
activemodel (5.2.3)
36+
activesupport (= 5.2.3)
37+
activerecord (5.2.3)
38+
activemodel (= 5.2.3)
39+
activesupport (= 5.2.3)
40+
arel (>= 9.0)
41+
activestorage (5.2.3)
42+
actionpack (= 5.2.3)
43+
activerecord (= 5.2.3)
44+
marcel (~> 0.3.1)
45+
activesupport (5.2.3)
46+
concurrent-ruby (~> 1.0, >= 1.0.2)
47+
i18n (>= 0.7, < 2)
48+
minitest (~> 5.1)
49+
tzinfo (~> 1.1)
50+
arel (9.0.0)
51+
bootsnap (1.4.4)
52+
msgpack (~> 1.0)
53+
builder (3.2.3)
54+
byebug (11.0.1)
55+
case_transform (0.2)
56+
activesupport
57+
concurrent-ruby (1.1.5)
58+
crass (1.0.4)
59+
diff-lcs (1.3)
60+
erubi (1.8.0)
61+
ffi (1.11.1)
62+
globalid (0.4.2)
63+
activesupport (>= 4.2.0)
64+
i18n (1.6.0)
65+
concurrent-ruby (~> 1.0)
66+
jsonapi-renderer (0.2.2)
67+
listen (3.1.5)
68+
rb-fsevent (~> 0.9, >= 0.9.4)
69+
rb-inotify (~> 0.9, >= 0.9.7)
70+
ruby_dep (~> 1.2)
71+
loofah (2.2.3)
72+
crass (~> 1.0.2)
73+
nokogiri (>= 1.5.9)
74+
mail (2.7.1)
75+
mini_mime (>= 0.1.1)
76+
marcel (0.3.3)
77+
mimemagic (~> 0.3.2)
78+
method_source (0.9.2)
79+
mimemagic (0.3.3)
80+
mini_mime (1.0.2)
81+
mini_portile2 (2.4.0)
82+
minitest (5.11.3)
83+
msgpack (1.3.0)
84+
nio4r (2.4.0)
85+
nokogiri (1.10.3)
86+
mini_portile2 (~> 2.4.0)
87+
puma (3.12.1)
88+
rack (2.0.7)
89+
rack-cors (1.0.3)
90+
rack-test (1.1.0)
91+
rack (>= 1.0, < 3)
92+
rails (5.2.3)
93+
actioncable (= 5.2.3)
94+
actionmailer (= 5.2.3)
95+
actionpack (= 5.2.3)
96+
actionview (= 5.2.3)
97+
activejob (= 5.2.3)
98+
activemodel (= 5.2.3)
99+
activerecord (= 5.2.3)
100+
activestorage (= 5.2.3)
101+
activesupport (= 5.2.3)
102+
bundler (>= 1.3.0)
103+
railties (= 5.2.3)
104+
sprockets-rails (>= 2.0.0)
105+
rails-dom-testing (2.0.3)
106+
activesupport (>= 4.2.0)
107+
nokogiri (>= 1.6)
108+
rails-html-sanitizer (1.0.4)
109+
loofah (~> 2.2, >= 2.2.2)
110+
railties (5.2.3)
111+
actionpack (= 5.2.3)
112+
activesupport (= 5.2.3)
113+
method_source
114+
rake (>= 0.8.7)
115+
thor (>= 0.19.0, < 2.0)
116+
rake (12.3.2)
117+
rb-fsevent (0.10.3)
118+
rb-inotify (0.10.0)
119+
ffi (~> 1.0)
120+
rspec-core (3.8.2)
121+
rspec-support (~> 3.8.0)
122+
rspec-expectations (3.8.4)
123+
diff-lcs (>= 1.2.0, < 2.0)
124+
rspec-support (~> 3.8.0)
125+
rspec-mocks (3.8.1)
126+
diff-lcs (>= 1.2.0, < 2.0)
127+
rspec-support (~> 3.8.0)
128+
rspec-rails (3.8.2)
129+
actionpack (>= 3.0)
130+
activesupport (>= 3.0)
131+
railties (>= 3.0)
132+
rspec-core (~> 3.8.0)
133+
rspec-expectations (~> 3.8.0)
134+
rspec-mocks (~> 3.8.0)
135+
rspec-support (~> 3.8.0)
136+
rspec-support (3.8.2)
137+
ruby_dep (1.5.0)
138+
spring (2.1.0)
139+
spring-watcher-listen (2.0.1)
140+
listen (>= 2.7, < 4.0)
141+
spring (>= 1.2, < 3.0)
142+
sprockets (3.7.2)
143+
concurrent-ruby (~> 1.0)
144+
rack (> 1, < 3)
145+
sprockets-rails (3.2.1)
146+
actionpack (>= 4.0)
147+
activesupport (>= 4.0)
148+
sprockets (>= 3.0.0)
149+
sqlite3 (1.4.1)
150+
thor (0.20.3)
151+
thread_safe (0.3.6)
152+
tzinfo (1.2.5)
153+
thread_safe (~> 0.1)
154+
websocket-driver (0.7.1)
155+
websocket-extensions (>= 0.1.0)
156+
websocket-extensions (0.1.4)
157+
158+
PLATFORMS
159+
ruby
160+
161+
DEPENDENCIES
162+
active_model_serializers
163+
bootsnap (>= 1.1.0)
164+
byebug
165+
listen (>= 3.0.5, < 3.2)
166+
puma (~> 3.11)
167+
rack-cors
168+
rails (~> 5.2.3)
169+
rspec-rails
170+
spring
171+
spring-watcher-listen (~> 2.0.0)
172+
sqlite3
173+
tzinfo-data
174+
175+
RUBY VERSION
176+
ruby 2.6.1p33
177+
178+
BUNDLED WITH
179+
2.0.2

api/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# README
2+
3+
This README would normally document whatever steps are necessary to get the
4+
application up and running.
5+
6+
Things you may want to cover:
7+
8+
* Ruby version
9+
10+
* System dependencies
11+
12+
* Configuration
13+
14+
* Database creation
15+
16+
* Database initialization
17+
18+
* How to run the test suite
19+
20+
* Services (job queues, cache servers, search engines, etc.)
21+
22+
* Deployment instructions
23+
24+
* ...

api/Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative 'config/application'
5+
6+
Rails.application.load_tasks
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module ApplicationCable
2+
class Connection < ActionCable::Connection::Base
3+
end
4+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::API
2+
end

api/app/controllers/concerns/.keep

Whitespace-only changes.

api/app/jobs/application_job.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationJob < ActiveJob::Base
2+
end

api/app/mailers/application_mailer.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationMailer < ActionMailer::Base
2+
default from: '[email protected]'
3+
layout 'mailer'
4+
end

api/app/models/application_record.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

api/app/models/concerns/.keep

Whitespace-only changes.

api/app/views/layouts/mailer.html.erb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<style>
6+
/* Email styles need to be inline */
7+
</style>
8+
</head>
9+
10+
<body>
11+
<%= yield %>
12+
</body>
13+
</html>

api/app/views/layouts/mailer.text.erb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%= yield %>

api/bin/bundle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env ruby
2+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3+
load Gem.bin_path('bundler', 'bundle')

api/bin/rails

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env ruby
2+
begin
3+
load File.expand_path('../spring', __FILE__)
4+
rescue LoadError => e
5+
raise unless e.message.include?('spring')
6+
end
7+
APP_PATH = File.expand_path('../config/application', __dir__)
8+
require_relative '../config/boot'
9+
require 'rails/commands'

api/bin/rake

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env ruby
2+
begin
3+
load File.expand_path('../spring', __FILE__)
4+
rescue LoadError => e
5+
raise unless e.message.include?('spring')
6+
end
7+
require_relative '../config/boot'
8+
require 'rake'
9+
Rake.application.run

api/bin/setup

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env ruby
2+
require 'fileutils'
3+
include FileUtils
4+
5+
# path to your application root.
6+
APP_ROOT = File.expand_path('..', __dir__)
7+
8+
def system!(*args)
9+
system(*args) || abort("\n== Command #{args} failed ==")
10+
end
11+
12+
chdir APP_ROOT do
13+
# This script is a starting point to setup your application.
14+
# Add necessary setup steps to this file.
15+
16+
puts '== Installing dependencies =='
17+
system! 'gem install bundler --conservative'
18+
system('bundle check') || system!('bundle install')
19+
20+
# puts "\n== Copying sample files =="
21+
# unless File.exist?('config/database.yml')
22+
# cp 'config/database.yml.sample', 'config/database.yml'
23+
# end
24+
25+
puts "\n== Preparing database =="
26+
system! 'bin/rails db:setup'
27+
28+
puts "\n== Removing old logs and tempfiles =="
29+
system! 'bin/rails log:clear tmp:clear'
30+
31+
puts "\n== Restarting application server =="
32+
system! 'bin/rails restart'
33+
end

api/bin/spring

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env ruby
2+
3+
# This file loads Spring without using Bundler, in order to be fast.
4+
# It gets overwritten when you run the `spring binstub` command.
5+
6+
unless defined?(Spring)
7+
require 'rubygems'
8+
require 'bundler'
9+
10+
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
11+
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
12+
if spring
13+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
14+
gem 'spring', spring.version
15+
require 'spring/binstub'
16+
end
17+
end

0 commit comments

Comments
 (0)