This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt at stubbing out a working API
- Loading branch information
Stuart
committed
Apr 3, 2014
1 parent
d3717ae
commit da50195
Showing
60 changed files
with
1,559 additions
and
216 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 |
---|---|---|
@@ -1,28 +1,37 @@ | ||
source 'https://rubygems.org' | ||
|
||
ruby '2.0.0' | ||
gem 'rails', '4.0.4' | ||
gem 'sass-rails', '~> 4.0.2' | ||
|
||
gem 'rails', '4.0.2' | ||
gem 'sass-rails', '~> 4.0.0' | ||
gem 'uglifier', '>= 1.3.0' | ||
gem 'coffee-rails', '~> 4.0.0' | ||
gem 'jquery-rails' | ||
gem 'turbolinks' | ||
gem 'jbuilder', '~> 1.2' | ||
gem 'bootstrap-sass' | ||
gem 'devise' | ||
gem 'mongoid', :github=>"mongoid/mongoid" | ||
gem 'unicorn' | ||
gem 'unicorn-rails' | ||
gem 'active_model_serializers' | ||
gem 'mongoid-serializer' | ||
gem 'rack-cors', :require => 'rack/cors' | ||
gem "bson" | ||
gem "moped" | ||
|
||
group :development do | ||
gem 'better_errors' | ||
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx] | ||
gem 'quiet_assets' | ||
gem 'rails_layout' | ||
gem 'pry' | ||
end | ||
group :development, :test do | ||
gem 'rspec-rails' | ||
end | ||
group :test do | ||
gem 'capybara' | ||
gem 'cucumber-rails', :require=>false | ||
gem 'database_cleaner', '1.0.1' | ||
gem 'email_spec' | ||
gem 'mongoid-rspec', '>= 1.10.0' | ||
gem 'launchy' | ||
gem 'mongoid-rspec', '>= 1.6.0', :github=>"evansagge/mongoid-rspec" | ||
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
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
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 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
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 @@ | ||
// Place all the styles related to the home controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class ApplicationController < ActionController::Base | ||
# Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | ||
protect_from_forgery with: :exception | ||
# protect_from_forgery with: :exception | ||
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,14 @@ | ||
class ClassificationsController < ApplicationController | ||
|
||
def create | ||
annotations = parmas["annotations"] | ||
subject_id = BSON::ObjectId.from_string params["subject_id"] | ||
workflow_id = BSON::ObjectId.from_string params["workflow_id"] | ||
user_id = BSON::ObjectId.from_string params["user_id"] | ||
|
||
Classification.create(workflow_id: workflow_id, subject_id: subject_id, user_id: user_id) | ||
end | ||
|
||
|
||
|
||
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,7 @@ | ||
class HomeController < ApplicationController | ||
def index | ||
@users = User.all | ||
end | ||
|
||
|
||
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,8 @@ | ||
class ProjectsController < ApplicationController | ||
respond_to :json | ||
|
||
def index | ||
respond_with Project.first | ||
end | ||
|
||
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,9 @@ | ||
class RegistrationsController < Devise::RegistrationsController | ||
before_filter :update_sanitized_params, if: :devise_controller? | ||
|
||
def update_sanitized_params | ||
devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)} | ||
devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation, :current_password)} | ||
end | ||
|
||
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,9 @@ | ||
class SubjectsController < ApplicationController | ||
respond_to :json | ||
|
||
def index | ||
workflow_id = params["workflow_id"] | ||
respond_with Subject.random(:workflow_ids => BSON::ObjectId.from_string(workflow_id) ).first | ||
end | ||
|
||
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,21 @@ | ||
class UsersController < ApplicationController | ||
before_filter :authenticate_user! | ||
respond_to :json | ||
|
||
|
||
def index | ||
@users = User.all | ||
respond_with @users | ||
end | ||
|
||
def show | ||
@user = User.find(params[:id]) | ||
respond_with @user | ||
end | ||
|
||
def current_user | ||
binding.pry | ||
respond_with current_user | ||
end | ||
|
||
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,2 @@ | ||
module HomeHelper | ||
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,10 @@ | ||
class Classification | ||
include Mongoid::Document | ||
|
||
field :annotations, type: Array | ||
|
||
belongs_to :workflow | ||
belongs_to :user | ||
belongs_to :subject | ||
|
||
end |
Oops, something went wrong.