Skip to content

Commit

Permalink
Merge pull request #576 from crossroads/master
Browse files Browse the repository at this point in the history
December2018Release1
  • Loading branch information
abhinav098 authored Dec 6, 2018
2 parents a8e0931 + 1dad1af commit f1ff3ee
Show file tree
Hide file tree
Showing 131 changed files with 6,573 additions and 348 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
environment:
RAILS_ENV: test
steps:
- run:
name: Install PostgreSQL Client (required to run migrations)
command: sudo apt-get install postgresql-client-9.6
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
Expand All @@ -65,6 +68,9 @@ jobs:
name: Wait for DB and Redis containers to start
command: dockerize -wait tcp://localhost:5432 -wait tcp://localhost:6379 -timeout 1m
- run: bundle exec rake db:create:all db:schema:load
- run:
name: Migrate 'timestamp without timezone' to 'timestamp with timezone'
command: bundle exec rake db:migrate:redo VERSION=20181122111014 RAILS_ENV=test
- run:
name: Rspec tests
command: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ coverage/
.env*
.byebug_history
coverage

.vscode
140 changes: 71 additions & 69 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ GIT

GIT
remote: https://github.com/maccman/nestful.git
revision: 4cfd929ee0a396aff0d5170a893599e59fded934
revision: 0d4b1598b50770483306a48f5b25934fa64f22f1
specs:
nestful (1.1.1)
nestful (1.1.3)

GIT
remote: https://github.com/radar/by_star.git
Expand All @@ -47,21 +47,21 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
actionmailer (4.2.11)
actionpack (= 4.2.11)
actionview (= 4.2.11)
activejob (= 4.2.11)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.10)
actionview (= 4.2.10)
activesupport (= 4.2.10)
actionpack (4.2.11)
actionview (= 4.2.11)
activesupport (= 4.2.11)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.10)
activesupport (= 4.2.10)
actionview (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
Expand All @@ -71,39 +71,40 @@ GEM
rotp
active_model_serializers (0.8.4)
activemodel (>= 3.0)
active_record_union (1.1.1)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (4.2.10)
activesupport (= 4.2.10)
activejob (4.2.11)
activesupport (= 4.2.11)
globalid (>= 0.3.0)
activemodel (4.2.10)
activesupport (= 4.2.10)
activemodel (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
activerecord (4.2.10)
activemodel (= 4.2.10)
activesupport (= 4.2.10)
activerecord (4.2.11)
activemodel (= 4.2.11)
activesupport (= 4.2.11)
arel (~> 6.0)
activesupport (4.2.10)
activesupport (4.2.11)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0)
annotate (2.7.4)
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 13.0)
arel (6.0.4)
aws_cf_signer (0.1.3)
barby (0.6.2)
braintree (2.58.0)
barby (0.6.6)
braintree (2.90.0)
builder (>= 2.0.0)
builder (3.2.3)
bullet (5.6.1)
bullet (5.7.6)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
byebug (8.2.2)
uniform_notifier (~> 1.11.0)
byebug (10.0.2)
cancancan (1.13.1)
capistrano (3.11.0)
airbrussh (>= 1.0.0)
Expand All @@ -125,44 +126,44 @@ GEM
cloudinary (1.1.2)
aws_cf_signer
rest-client
coderay (1.1.1)
concurrent-ruby (1.0.5)
coderay (1.1.2)
concurrent-ruby (1.1.3)
connection_pool (2.2.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.4)
diff-lcs (1.3)
docile (1.3.1)
domain_name (0.5.20160216)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
dotenv (0.11.1)
dotenv-deployment (~> 0.0.2)
dotenv-deployment (0.0.2)
dotenv-rails (0.11.1)
dotenv (= 0.11.1)
erubis (2.7.0)
execjs (2.6.0)
execjs (2.7.0)
factory_bot (4.10.0)
activesupport (>= 3.0.0)
factory_bot_rails (4.10.0)
factory_bot (~> 4.10.0)
railties (>= 3.0.0)
faraday (0.15.2)
faraday (0.15.3)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
ffaker (2.8.1)
ffaker (2.10.0)
ffi (1.9.25)
foreman (0.78.0)
foreman (0.85.0)
thor (~> 0.19.1)
formatador (0.2.5)
gli (2.17.1)
gli (2.18.0)
globalid (0.4.1)
activesupport (>= 4.2.0)
guard (2.13.0)
guard (2.14.2)
formatador (>= 0.2.4)
listen (>= 2.7, <= 4.0)
lumberjack (~> 1.0)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
Expand All @@ -185,22 +186,23 @@ GEM
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
listen (3.0.6)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9.7)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
lograge (0.3.6)
actionpack (>= 3)
activesupport (>= 3)
railties (>= 3)
loofah (2.2.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.10)
mail (2.7.0)
lumberjack (1.0.13)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (0.8.2)
method_source (0.9.0)
mime-types (2.99.3)
mini_mime (1.0.0)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
Expand All @@ -213,7 +215,7 @@ GEM
newrelic_rpm (5.2.0.345)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
notiffany (0.0.8)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
oj (3.6.2)
Expand All @@ -233,29 +235,29 @@ GEM
prawn (2.0.2)
pdf-core (~> 0.6.0)
ttfunk (~> 1.4.0)
pry (0.10.3)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
method_source (~> 0.9.0)
public_suffix (3.0.3)
puma (3.12.0)
rack (1.6.10)
rack (1.6.11)
rack-cors (1.0.2)
rack-protection (2.0.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rack-timeout (0.3.2)
railroady (1.4.2)
rails (4.2.10)
actionmailer (= 4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
activemodel (= 4.2.10)
activerecord (= 4.2.10)
activesupport (= 4.2.10)
rails (4.2.11)
actionmailer (= 4.2.11)
actionpack (= 4.2.11)
actionview (= 4.2.11)
activejob (= 4.2.11)
activemodel (= 4.2.11)
activerecord (= 4.2.11)
activesupport (= 4.2.11)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.10)
railties (= 4.2.11)
sprockets-rails
rails-api (0.4.1)
actionpack (>= 3.2.11)
Expand All @@ -271,16 +273,16 @@ GEM
rails-i18n (4.0.8)
i18n (~> 0.7)
railties (~> 4.0)
railties (4.2.10)
actionpack (= 4.2.10)
activesupport (= 4.2.10)
railties (4.2.11)
actionpack (= 4.2.11)
activesupport (= 4.2.11)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
rake-progressbar (0.0.5)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-readline (0.5.5)
redis (3.3.5)
redis-actionpack (5.0.2)
Expand Down Expand Up @@ -332,6 +334,7 @@ GEM
builder (< 4)
rspec-core (>= 2, < 4, != 2.12.0)
ruby-graphviz (1.2.3)
ruby_dep (1.5.0)
rufus-scheduler (3.3.4)
tzinfo
safe_yaml (1.0.4)
Expand Down Expand Up @@ -368,7 +371,6 @@ GEM
gli
hashie
websocket-driver
slop (3.6.0)
spring (1.6.4)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
Expand Down Expand Up @@ -398,8 +400,8 @@ GEM
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
uniform_notifier (1.10.0)
unf_ext (0.0.7.5)
uniform_notifier (1.11.0)
warden (1.2.6)
rack (>= 1.0)
webmock (1.24.1)
Expand Down Expand Up @@ -493,4 +495,4 @@ RUBY VERSION
ruby 2.5.1p57

BUNDLED WITH
1.16.3
1.17.1
66 changes: 66 additions & 0 deletions app/controllers/api/v1/appointment_slot_presets_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module Api
module V1
class AppointmentSlotPresetsController < Api::V1::ApiController
load_and_authorize_resource :appointment_slot_preset, parent: false

resource_description do
short 'Manage a list of appointment slot templates for days of the week.'
formats ['json']
error 401, "Unauthorized"
error 404, "Not Found"
error 422, "Validation Error"
error 500, "Internal Server Error"
end

def_param_group :appointment_slot_preset do
param :appointment_slot_preset, Hash, required: true do
param :hours, :number
param :minutes, :number
param :quota, :number
param :day, :number
end
end

def appointment_slot_preset_params
params.require(:appointment_slot_preset).permit([:hours, :minutes, :day, :quota])
end

api :GET, '/v1/appointment_slot_presets', "List all preset appointment slots"
def index
render json: @appointment_slot_presets.ascending, each_serializer: serializer, status: 200
end

api :POST, "/v1/appointment_slot_presets", "Add a preset appointment slot"
param_group :appointment_slot_preset
def create
preset = AppointmentSlotPreset.find_or_create_by(
day: @appointment_slot_preset.day,
hours: @appointment_slot_preset.hours,
minutes: @appointment_slot_preset.minutes
)
preset.quota = @appointment_slot_preset.quota
save_and_render_object(preset)
end

api :PUT, '/v1/appointment_slot_presets/1', "Update a preset appointment slot"
param_group :appointment_slot_preset
def update
if @appointment_slot_preset.update_attributes(appointment_slot_preset_params)
render json: @appointment_slot_preset, serializer: serializer
else
render json: @appointment_slot_preset.errors, status: 422
end
end

api :DELETE, '/v1/appointment_slot_presets/1', "Delete a preset appointment slot"
def destroy
@appointment_slot_preset.destroy
render json: {}
end

def serializer
Api::V1::AppointmentSlotPresetSerializer
end
end
end
end
Loading

0 comments on commit f1ff3ee

Please sign in to comment.