acts_responsible 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1669e05d3269e0ffb9b5ecf35ba727f571e09c1a
4
- data.tar.gz: c57a006f18a768035260dd372a8f3bcb7520ef4c
3
+ metadata.gz: 9908d8a71f51a90e2f7181da2fef994149221d79
4
+ data.tar.gz: cc9c2624bd1c6a8170fc6dad96a17afc17e7a444
5
5
  SHA512:
6
- metadata.gz: 6ecdfbf7202c1d6a6fa957b1248a38a590a92c871119b39f4ea6b0c8d5e8ded595a05fe0b582c743694f8eb78244b21adde55814e23ce0560f94f770e24dd7fc
7
- data.tar.gz: 82e560c6615670f6c0fa32a9fa461827517fe7a4a4106e12ecbc8f504d86d48ab68bd055d6b6e7f3fc42452b8621413659bcfd2a468cf7ac32087564c69f4d8d
6
+ metadata.gz: abc86965229b146a8b839210eca05244ac8e42967d01426d912589e29bfb58e64b8261ea6b4c678f6293a55b0c7f5ab877d11b1a75a739ec1fdbb6ea3ad1c00d
7
+ data.tar.gz: ad6d540123e0808f725022845a094a0ec62b36dc61707f498e59e46219acb05a0275913aaac5cc5b352914efc3c3b08896f082ca6c8fdf6280980c46d9647e48
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # ActsResponsible
2
2
 
3
- TODO: Write a gem description
4
-
5
3
  ## Installation
6
4
 
7
5
  Add this line to your application's Gemfile:
@@ -18,11 +16,66 @@ Or install it yourself as:
18
16
 
19
17
  ## Usage
20
18
 
21
- TODO: Write usage instructions here
19
+ 1. Add `acts_responsible` to your API controller(s):
20
+
21
+ ```ruby
22
+ include ActsResponsible
23
+
24
+ class Api::V1::ApiController < ApplicationController
25
+
26
+ acts_responsible('api/v1')
27
+
28
+ end
29
+ ```
30
+
31
+ 2. Render your responses, complete with errors or metadata:
32
+
33
+ ```ruby
34
+ class Api::V1::PostsController < API::V1::ApiController
35
+
36
+ def index
37
+ @posts = Post.all
38
+ # 200 OK with a root-level `posts` collection that
39
+ # renders @posts using a "posts/post" RABL template
40
+ render_response @posts, 'posts', 'posts/post'
41
+ end
42
+
43
+ def create
44
+ @post = Post.new(article_params)
45
+ if @post.save
46
+ # render the new post's `id` using a simple "id" RABL template
47
+ render_response @post, 'post', 'id'
48
+ # OR we could simply render a 200 OK with empty body
49
+ render_empty_response
50
+ else
51
+ # take an HTTP status code and automatically parse ActiveRecord errors
52
+ render_error :unprocessable_entity, @post.errors
53
+ end
54
+ end
55
+
56
+ end
57
+ ```
58
+
59
+ - Example `posts/post.rabl` template:
60
+
61
+ ```ruby
62
+ attributes :id, :title, :body
63
+
64
+ node :created_at do |post|
65
+ post.created_at.utc.to_i
66
+ end
67
+ ```
68
+
69
+ - Example `id.rabl` template:
70
+
71
+ ```ruby
72
+ attributes :id
73
+ ```
74
+
22
75
 
23
76
  ## Contributing
24
77
 
25
- 1. Fork it ( https://github.com/[my-github-username]/acts_responsible/fork )
78
+ 1. Fork it ( https://github.com/danlite/acts_responsible/fork )
26
79
  2. Create your feature branch (`git checkout -b my-new-feature`)
27
80
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
81
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module ActsResponsible
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_responsible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lichty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabl
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.11'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.11'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement