jam-ruby 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +15 -2
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
= Jam
|
2
2
|
|
3
|
-
|
3
|
+
Jam - Simple, readable and flexible JSON Api Maker based on standart rails tools and hash syntax.
|
4
4
|
|
5
5
|
== Installation
|
6
6
|
|
7
|
-
|
7
|
+
Install Jam as a gem:
|
8
|
+
|
9
|
+
gem install jam-ruby
|
10
|
+
|
11
|
+
or add to your Gemfile:
|
12
|
+
|
13
|
+
gem 'jam-ruby', :require => 'jam'
|
8
14
|
|
9
15
|
== Configuration
|
10
16
|
|
@@ -16,6 +22,7 @@ Standart Rails configuration:
|
|
16
22
|
|
17
23
|
=== Basic usage
|
18
24
|
|
25
|
+
# app/views/posts/show.json.jam
|
19
26
|
object @post do |p|
|
20
27
|
{
|
21
28
|
:body => p.downcase
|
@@ -24,6 +31,7 @@ Standart Rails configuration:
|
|
24
31
|
|
25
32
|
=== Use to_json attributes (only, except, methods, root)
|
26
33
|
|
34
|
+
# app/views/posts/show.json.jam
|
27
35
|
object @post, :only => [:title] do |p|
|
28
36
|
{
|
29
37
|
:body => p.downcase
|
@@ -32,6 +40,7 @@ Standart Rails configuration:
|
|
32
40
|
|
33
41
|
=== For collections
|
34
42
|
|
43
|
+
# app/views/posts/index.json.jam
|
35
44
|
collection @posts { |p|
|
36
45
|
{
|
37
46
|
:body => p.downcase
|
@@ -40,12 +49,14 @@ Standart Rails configuration:
|
|
40
49
|
|
41
50
|
=== Use template
|
42
51
|
|
52
|
+
# app/views/posts/index.json.jam
|
43
53
|
collection @posts do |post|
|
44
54
|
template('posts/show', :@post => post)
|
45
55
|
end
|
46
56
|
|
47
57
|
=== Add children
|
48
58
|
|
59
|
+
# app/views/posts/index.json.jam
|
49
60
|
collection @posts do |p|
|
50
61
|
{
|
51
62
|
:comments => collection p.comments, :only => [:body]...
|
@@ -58,6 +69,8 @@ Works like in Rails to_json:
|
|
58
69
|
|
59
70
|
object @post, :root => :bost
|
60
71
|
|
72
|
+
[Other examples](https://github.com/edtsech/jam/tree/master/examples)
|
73
|
+
|
61
74
|
== Contributions
|
62
75
|
|
63
76
|
We open for you contributions, sugesstions and ideas.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jam-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Edward Tsech
|
@@ -19,7 +19,7 @@ date: 2011-07-17 00:00:00 +07:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description: JSON Api Maker.
|
22
|
+
description: Simple, readable and flexible JSON Api Maker based on standart rails tools and hash syntax.
|
23
23
|
email:
|
24
24
|
- edtsech@gmail.com
|
25
25
|
executables: []
|