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
- content_for :breadcrumb do | |
= link_to 'Mine prosjekter', projects_path | |
| > | |
= @department.title | |
table | |
thead | |
th | |
th Kunde |
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
class ExcelController < ApplicationController | |
layout :resolve_layout | |
def dagsrapport | |
project = Project.find(params[:project_id]) | |
profession = Profession.find(params[:profession_id]) | |
overtime = params[:overtime] | |
file_name = Dagsrapport.new(project: project, profession: profession, | |
overtime: overtime).create_spreadsheet | |
respond_to do |format| |
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 Base < API | |
puts "in Base" | |
version 'v1', using: :path, vendor: 'orwapp', cascade: false | |
mount Users | |
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
class API < Grape::API | |
prefix 'api' | |
format :json | |
default_format :json | |
mount ::V1::Base | |
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
require 'spec_helper' | |
describe V1::Users do | |
describe 'GET /api/v1/users' do | |
it 'returns array of users' do | |
3.times { Fabricate :user } | |
get '/api/v1/users', {}, https_and_authorization | |
response.status.should eq 200 | |
expected_ids = User.all.page(1).map { |a| a.id.to_s } | |
expected_ids.each { |id| response.body.should match id } |
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 | |
desc 'Lookup of single user' | |
get 'martin' do | |
'hello' | |
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 |
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 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
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 |