Skip to content

Instantly share code, notes, and snippets.

View stabenfeldt's full-sized avatar
🎯
Focusing

Martin Stabenfeldt stabenfeldt

🎯
Focusing
View GitHub Profile
harvester_webservice:
build:
image: stabenfeldt/harvester_webservice
dockerfile_path: Dockerfile
links:
- mongo1
- elasticsearch
mongo3:
hostname: mongo3
'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');
#
# 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
# == 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
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
module V1
class Users < Base
resource :users do
params do
requires :id, type: Integer, desc: "Status id."
end
route_param :id do
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
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
module V1
module Entities
class Tasks < Grape::Entity
expose :id, :description, :project_id, :project_url
end
def project_url
'http://db.no'
end
end
module V1
module Entities
class Users < Grape::Entity
expose :id, :first_name, :last_name
end
end
end