serviceable 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +18 -17
  2. data/lib/serviceable.rb +3 -3
  3. metadata +5 -5
data/README.md CHANGED
@@ -5,33 +5,34 @@ Serviceable aims to reduce code duplication for common patterns, such as JSON/XM
5
5
  API endpoints. Instead of repeating the same patterns in multiple controllers and
6
6
  trying to maintain that over time, we extracted those patterns into a module.
7
7
 
8
+ Controller:
8
9
 
9
- class PostsController < ApplicationController
10
+ class PostsController < ApplicationController
11
+
12
+ include Serviceable
13
+ acts_as_service :post
14
+
15
+ end
10
16
 
11
- include Serviceable
12
- acts_as_service :post
13
-
14
- end
15
-
16
- resources :posts
17
+ Route:
17
18
 
19
+ resources :posts
18
20
 
19
21
 
20
22
  Standard CRUD
21
23
  -------------
22
24
 
23
- POST /posts.json
24
- GET /posts.json
25
- GET /posts/1.json
26
- PUT /posts/1.json
27
- DELETE /posts/1.json
25
+ POST /posts.json
26
+ GET /posts.json
27
+ GET /posts/1.json
28
+ PUT /posts/1.json
29
+ DELETE /posts/1.json
28
30
 
29
31
  Query Params
30
32
  ------------
31
33
 
32
- GET /posts.json
33
- [{"id":1,"title":"First Post!","body":"Feels good to be first","created_at":"20130727T16:26:00Z"}]
34
-
35
- GET /posts.json?only=id,title
36
- [{"id":1,"title","First post!"}]
34
+ GET /posts.json
35
+ [{"id":1,"title":"First Post!","body":"Feels good to be first","created_at":"20130727T16:26:00Z"}]
37
36
 
37
+ GET /posts.json?only=id,title
38
+ [{"id":1,"title","First post!"}]
data/lib/serviceable.rb CHANGED
@@ -61,14 +61,14 @@ module Serviceable
61
61
  eval "@#{object}.destroy"
62
62
 
63
63
  respond_to do |format|
64
- format.json { head :ok }
65
- format.xml { head :ok }
64
+ format.json { head :no_content }
65
+ format.xml { head :no_content }
66
66
  end
67
67
  end
68
68
 
69
69
  define_method("merge_options") do |options={}|
70
70
  merged_options = options || {}
71
- for key in [:only, :except]
71
+ for key in [:only, :except, :include]
72
72
  merged_options = merged_options.merge({key => params[key].split(",")}) if params[key]
73
73
  end
74
74
  return merged_options
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serviceable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aubrey Goodman
@@ -30,8 +30,8 @@ files:
30
30
  - LICENSE
31
31
  - README.md
32
32
  homepage: https://github.com/verifip/serviceable
33
- licenses: []
34
-
33
+ licenses:
34
+ - MIT
35
35
  post_install_message:
36
36
  rdoc_options: []
37
37