jsonapi-resources 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5e235b0488716337c8c547c7a97bdbd1df7c05a
4
- data.tar.gz: af645d11d41b982eb57a1c7a340be2692a9633a9
3
+ metadata.gz: 5eb2793fc0bf0e02a6224a77143049fb497b7fcb
4
+ data.tar.gz: 9e4af0e18b535c6bb61252f3e6b7f4d6c45d55d8
5
5
  SHA512:
6
- metadata.gz: 4365d7b76273359e386534a52a9ba7a40608d674c4e643815f564588afa8480f16b61cad7337e78dc13162872ae84e6b7a6fd9ca1a0a4d262f22877633fab008
7
- data.tar.gz: 8f6bc0f211760c55df35515e61833bb3413ace9c093b9f56b5ec45b875476043110a2acc49b42446efb588ab9b63cb7958bece1e688b26bcb044f89614aad8e6
6
+ metadata.gz: e93a730c3e5fbc508463c16a4cf54553697d2307b99bc320850b1486a6d312795ed56b1c4aba89075b3523317ffe64b85167cc8c0e748c9819f6923e97711a2e
7
+ data.tar.gz: 98b86070d30b544ecf95398956a92c84200d25867323467d3f0bd1cd591b2456a7b9015b592d84899f5936f885858f252d8756643f76ecf8e32352ba702637ec
data/README.md CHANGED
@@ -188,7 +188,7 @@ The association methods support the following options:
188
188
  * `class_name` - a string specifying the underlying class for the related resource
189
189
  * `primary_key` - the primary key to the related resource, if different than `id`
190
190
  * `key` - the key in the resource that identifies the related resource, if different than `<resource_name>_id`
191
- * `treat_as_set` - allows the entire set of related records to be replaced in one operation. Defaults to false if not set.
191
+ * `acts_as_set` - allows the entire set of related records to be replaced in one operation. Defaults to false if not set.
192
192
 
193
193
  Examples:
194
194
 
@@ -197,7 +197,7 @@ Examples:
197
197
  attributes :id, :body
198
198
  has_one :post
199
199
  has_one :author, class_name: 'Person'
200
- has_many :tags, treat_as_set: true
200
+ has_many :tags, acts_as_set: true
201
201
  end
202
202
  ```
203
203
 
@@ -377,8 +377,7 @@ JR has a couple of helper methods available to assist you with setting up routes
377
377
 
378
378
  ##### `jsonapi_resources`
379
379
 
380
- Like `resources` in ActionDispatch provides a resourceful route provides a mapping between HTTP verbs and URLs and
381
- controller actions. This will also setup mappings for relationship URLs for a resource's associations. For example
380
+ Like `resources` in ActionDispatch, `jsonapi_resources` provides resourceful routes mapping between HTTP verbs and URLs and controller actions. This will also setup mappings for relationship URLs for a resource's associations. For example
382
381
 
383
382
  ```
384
383
  require 'jsonapi/routing_ext'
@@ -5,7 +5,7 @@ module JSONAPI
5
5
  @options = options
6
6
  @key = options[:key] ? options[:key].to_sym : nil
7
7
  @primary_key = options.fetch(:primary_key, 'id').to_sym
8
- @treat_as_set = options.fetch(:treat_as_set, false) == true
8
+ @acts_as_set = options.fetch(:acts_as_set, false) == true
9
9
  end
10
10
 
11
11
  def key
@@ -16,8 +16,8 @@ module JSONAPI
16
16
  @primary_key
17
17
  end
18
18
 
19
- def treat_as_set
20
- @treat_as_set
19
+ def acts_as_set
20
+ @acts_as_set
21
21
  end
22
22
 
23
23
  def serialize_type_name
@@ -295,7 +295,7 @@ module JSONAPI
295
295
  associations = []
296
296
 
297
297
  @_associations.each do |key, association|
298
- if association.is_a?(JSONAPI::Association::HasOne) || association.treat_as_set
298
+ if association.is_a?(JSONAPI::Association::HasOne) || association.acts_as_set
299
299
  associations.push(key)
300
300
  end
301
301
  end
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -331,8 +331,8 @@ class PostResource < JSONAPI::Resource
331
331
 
332
332
  has_one :author, class_name: 'Person'
333
333
  has_one :section
334
- has_many :tags, treat_as_set: true
335
- has_many :comments, treat_as_set: false
334
+ has_many :tags, acts_as_set: true
335
+ has_many :comments, acts_as_set: false
336
336
  def subject
337
337
  @object.title
338
338
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
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
  - Dan Gebhardt