acfs 0.25.0.1.b217 → 0.25.0.1.b221

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +38 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODFjYTJmYTI0YTdlZjExMWFkNTExNGM5NWFjYzllNmU5YTZiNzE2Nw==
4
+ NjU1NzljOTE4ODEwMjcyZDliM2U0YjY5YTBiYWQ2OWU1MDI1ZjMxYQ==
5
5
  data.tar.gz: !binary |-
6
- NDA1ZGRjYmRlZDBjNDBmZDRmZGM1NTQ2N2I2NjcxMjRmNzNjNWE3Ng==
6
+ OTdiOTlmNzYzNTY1MGRmY2NiOTE4NjU0NWY4ZmYyNTI1NDI0OTVmNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjY2ODgyN2Y3ZTI4MTU2OGM5ZDQzMTY1OWU3M2VkNWFmY2QzODAyZTk0NGE4
10
- NjUyOTY0Y2QxNmMxNzBjMTUxZjNhNTZjN2ZkOWM5M2I5ZjVmNzgxNTc1YzE2
11
- MDZiYTNlZGNkN2MxMGVhZjY0M2JlMzYyNGU0ODY4N2FmOWYxZjQ=
9
+ NjZlZmUxNjI1OTNkNjQzOGEzMWI1ZjM5NTk0NzA2OTY2MDM4ZjY3NjZiZTYy
10
+ NDhlZTZiY2IyYzU1OWFhZWYxODNlYjk2OTYyMWU0NGU4MzgxYmY5Zjg4Zjg4
11
+ ODk2ODNiMDg0YzEzZjMzZTllNjIzNmMzYTE3ZTdkN2M1ZDM1YWY=
12
12
  data.tar.gz: !binary |-
13
- ZWI0MmZkMmMxMzRjODk2ZTFkYzFlMTRmNjY1OGZhMDY0MTRhNzExMDdhMGQ0
14
- MGNjNjdkNmRlZjJkYTFiYTg4M2Y2MTdlOTliOGM4OWZkMDdiZGNiOTQyNjc0
15
- NzQzYjg0N2RiYzcxMDc5Njk3ZmE4YWQ2MGMzNzQwNjIzYjAxZDE=
13
+ ZmYwMzQyNjUyYmY2MDk3ZjAzOTU4NDFhMjc0YzVlNTFiZWJiMjQ2ODM5N2My
14
+ NTQyM2U0NWEyZjA1OGVlZTZhZDc1ZGNhZTJkZTQzNmRiODI1ZTcyNGMwM2Vi
15
+ YjJiZTExMzE0ZTZiYmRlZjNlZjM1ODdjNzlkMTU4MjJlZmYxZjY=
data/README.md CHANGED
@@ -138,6 +138,44 @@ Acfs has basic update support using `PUT` requests:
138
138
  @user.persisted? # => true
139
139
  ```
140
140
 
141
+ ## Singleton resources
142
+
143
+ Singletons can be used in Acfs by creating a new resource which inherits from `SingletonResource`:
144
+
145
+ ```ruby
146
+ class Single < Acfs::SingletonResource
147
+ service UserService # Associate `Single` model with `UserService`.
148
+
149
+ # Define model attributes and types as with regular resources
150
+
151
+ attribute :name, :string, default: 'Anonymous'
152
+ attribute :age, :integer
153
+
154
+ end
155
+ ```
156
+
157
+ The following code explains the routing for singleton resource requests:
158
+
159
+ ```ruby
160
+ my_single = Single.new
161
+ mysingle.save # sends POST request to /single
162
+
163
+ my_single = Single.find
164
+ Acfs.run # sends GET request to /single
165
+
166
+ my_single.age = 28
167
+ my_single.save # sends PUT request to /single
168
+
169
+ my_single.delete # sends DELETE request to /single
170
+ ```
171
+
172
+ You also can pass parameters to the find call, these will sent as GET params to the index action:
173
+
174
+ ```ruby
175
+ my_single = Single.find name: 'Max'
176
+ Acfs.run # sends GET request with param to /single?name=Max
177
+ ```
178
+
141
179
  ## Resource Inheritance
142
180
 
143
181
  Acfs provides a resource inheritance similar to ActiveRecord Single Table Inheritance. If a
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0.1.b217
4
+ version: 0.25.0.1.b221
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-13 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport