This file contains hidden or 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
harvester_webservice: | |
build: | |
image: stabenfeldt/harvester_webservice | |
dockerfile_path: Dockerfile | |
links: | |
- mongo1 | |
- elasticsearch | |
mongo3: | |
hostname: mongo3 |
This file contains hidden or 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
'use strict'; | |
/*eslint-disable dot-notation */ | |
/*eslint-disable handle-callback-err */ | |
var async = require('async'); | |
var config = require('../../config/config'); | |
var request = require('superagent'); | |
var mongoose = require('mongoose'); | |
var mongoUrl = config.get('mongoUrl'); |
This file contains hidden or 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
# | |
# Basically following the role based authorization approach explained by | |
# https://github.com/ryanb/cancan/wiki/Role-Based-Authorization | |
# | |
module User::Role | |
extend ActiveSupport::Concern | |
ROLES = [:user, :admin] | |
DEFAULT = :user |
This file contains hidden or 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
# == Schema Information | |
# | |
# Table name: tasks | |
# | |
# id :integer not null, primary key | |
# customer_id :integer | |
# start_date :date | |
# customer_buys_supplies :boolean | |
# created_at :datetime | |
# updated_at :datetime |
This file contains hidden or 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
tree 9060b23f8938c07b20af9729eb28b20076f6bc75 | |
parent 15c6ec3d071220ab1d5595145e3a6a996a89111d | |
author Jakub Głuszecki <[email protected]> Thu Sep 25 13:16:54 2014 +0200 | |
committer Jakub Głuszecki <[email protected]> Thu Sep 25 13:16:54 2014 +0200 | |
code format/cleanup | |
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb | |
index 91c7195..8dbcafd 100644 |
This file contains hidden or 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
module V1 | |
class Users < Base | |
resource :users do | |
params do | |
requires :id, type: Integer, desc: "Status id." | |
end | |
route_param :id do |
This file contains hidden or 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
require 'spec_helper' | |
describe V1::Users do | |
describe 'GET /api/v1/users/:id' do | |
it 'lists a specific user' do | |
user = Fabricate :user | |
user.should be_valid | |
get "/api/v1/users/#{ user.id }" | |
response.status.should == 200 |
This file contains hidden or 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
module V1 | |
module Entities | |
class Tasks < Grape::Entity | |
#expose :id, :description, :project_id | |
#expose :project_url | |
expose :attr_not_on_wrapped_object | |
end | |
def attr_not_on_wrapped_object | |
42 |
This file contains hidden or 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
module V1 | |
module Entities | |
class Tasks < Grape::Entity | |
expose :id, :description, :project_id, :project_url | |
end | |
def project_url | |
'http://db.no' | |
end | |
end |
This file contains hidden or 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
module V1 | |
module Entities | |
class Users < Grape::Entity | |
expose :id, :first_name, :last_name | |
end | |
end | |
end |