Module: Fakecrm::CustomTypes

Included in:
Server
Defined in:
lib/fakecrm/server/custom_types.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/fakecrm/server/custom_types.rb', line 6

def self.included(base)
  base.class_eval do

    get '/crm/api/custom_types.?:format?' do
      fetch_many(CustomType)
    end

    get '/crm/api/custom_types/:id.?:format?' do |id, format|
      fetch_one(CustomType, id)
    end

    put '/crm/api/custom_types/:id.?:format?' do |id, format|
      update_one(CustomType, id, params["custom_type"])
    end

    post '/crm/api/custom_types.?:format?' do
      create_one(CustomType, params["custom_type"])
    end

    delete '/crm/api/custom_types/:id.?:format?' do |id, format|
      destroy_one(CustomType, id)
    end

  end

end