jsonapi_compliable 0.6.7 → 0.6.8

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: 9f46b94a397759f05cd7537d79b05e67ca9fd20c
4
- data.tar.gz: a35204dce94ff15fee19a052f95e12c6c44ad414
3
+ metadata.gz: 62ef8f2928ce29e36d96ed0eb6b79513a8e2966e
4
+ data.tar.gz: 0a480dfac6e92b1c4e9491b46078c0a95bc15627
5
5
  SHA512:
6
- metadata.gz: 351229549de82a6e3e1e448018adf10135c603200a9ff14a859d6fc3bf2a5a0b117a5d488abfc757a353c6aa719d4b286e0d6c6c06c4a4813ab44730598acd3b
7
- data.tar.gz: 446f344728c8ec9fe881dd84db1e017b8c7cc51c91cf9730192111a8e9d8c768fcbf83a535892be69c878a9aafece275f1a6a7d6fb09e533c77d028bed4faf08
6
+ metadata.gz: 8bed61f5bc597f389a838ab43bfe411689b878aa12d2dc0395b58e8d66fb1ab39bc6cc3329872b5a77ecef5f73ffcdb9eaae90f135b685ea9237fc04d42c26c3
7
+ data.tar.gz: 5ccffb4f60669279d560efe15ba667414f761fc0cfdb1b0cfe6f60eeb83fa07c9be69727e4f36e820a2c15a134b348f60935664a6ca58835f9110e7b5decfe60
@@ -63,8 +63,8 @@ module JsonapiCompliable
63
63
  # This returns MyResource.new
64
64
  #
65
65
  # @return [Resource] the configured Resource for this controller
66
- def resource
67
- @resource ||= self.class._jsonapi_compliable.new
66
+ def jsonapi_resource
67
+ @jsonapi_resource ||= self.class._jsonapi_compliable.new
68
68
  end
69
69
 
70
70
  # Instantiates the relevant Query object
@@ -72,13 +72,13 @@ module JsonapiCompliable
72
72
  # @see Query
73
73
  # @return [Query] the Query object for this resource/params
74
74
  def query
75
- @query ||= Query.new(resource, params)
75
+ @query ||= Query.new(jsonapi_resource, params)
76
76
  end
77
77
 
78
78
  # @see Query#to_hash
79
79
  # @return [Hash] the normalized query hash for only the *current* resource
80
80
  def query_hash
81
- @query_hash ||= query.to_hash[resource.type]
81
+ @query_hash ||= query.to_hash[jsonapi_resource.type]
82
82
  end
83
83
 
84
84
  # Tracks the current context so we can refer to it within any
@@ -89,7 +89,7 @@ module JsonapiCompliable
89
89
  # @yieldreturn Code to run within the current context
90
90
  def wrap_context
91
91
  if self.class._jsonapi_compliable
92
- resource.with_context(self, action_name.to_sym) do
92
+ jsonapi_resource.with_context(self, action_name.to_sym) do
93
93
  yield
94
94
  end
95
95
  end
@@ -113,7 +113,7 @@ module JsonapiCompliable
113
113
  # @see Resource#build_scope
114
114
  # @return [Scope] the configured scope
115
115
  def jsonapi_scope(scope, opts = {})
116
- resource.build_scope(scope, query, opts)
116
+ jsonapi_resource.build_scope(scope, query, opts)
117
117
  end
118
118
 
119
119
  # @see Deserializer#initialize
@@ -148,7 +148,7 @@ module JsonapiCompliable
148
148
  # @return [Util::ValidationResponse]
149
149
  def jsonapi_create
150
150
  _persist do
151
- resource.persist_with_relationships \
151
+ jsonapi_resource.persist_with_relationships \
152
152
  deserialized_params.meta,
153
153
  deserialized_params.attributes,
154
154
  deserialized_params.relationships
@@ -179,7 +179,7 @@ module JsonapiCompliable
179
179
  # @return [Util::ValidationResponse]
180
180
  def jsonapi_update
181
181
  _persist do
182
- resource.persist_with_relationships \
182
+ jsonapi_resource.persist_with_relationships \
183
183
  deserialized_params.meta,
184
184
  deserialized_params.attributes,
185
185
  deserialized_params.relationships
@@ -254,7 +254,7 @@ module JsonapiCompliable
254
254
 
255
255
  def _persist
256
256
  validation_response = nil
257
- resource.transaction do
257
+ jsonapi_resource.transaction do
258
258
  object = yield
259
259
  validation_response = Util::ValidationResponse.new \
260
260
  object, deserialized_params
@@ -1,3 +1,3 @@
1
1
  module JsonapiCompliable
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi_compliable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Richmond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-05-08 00:00:00.000000000 Z
12
+ date: 2017-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jsonapi-serializable