jsonapi-resources 0.8.0.beta1 → 0.8.0.beta2

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: d825825bdf720bb3b498b9975b9455c52df1ed92
4
- data.tar.gz: fad2b60d570a85cadb6fc44a073cd316d0ed3650
3
+ metadata.gz: 6619fb440bc0c0441a39af1623ba5b9b28ac7b86
4
+ data.tar.gz: daa7f4b1e08fa81c03063269ea7637afa8375229
5
5
  SHA512:
6
- metadata.gz: 4f10510695282091866599ec8ca994d25ba348e98a12b8cc9501ab9e0a1b6f0f054e43ceb0091078cac26d05b43c6971db22a73350662186b6126d4ce888520d
7
- data.tar.gz: 9aaa540340d1426f24269dc2bf3813931256b3dfb1e9e0c667967ee103262033ad8834be14a564e1fe817820392e6e80d4001fda3763a8155e0fa4686c4efe74
6
+ metadata.gz: c3966400df28279c2bdc1c4af30f13003d119866e272667c5796b7cd32eb6f55eab26290169a918ff13e8579ec586863da6ebfa21aa2e97c4925c68a57df110f
7
+ data.tar.gz: eaf11f0fa4bfe023d7bc75ce6441ace0112d6aa1f9281574dc74944c3b7525cf90ec96989510474fe4d6690966d1c046ed82af130e698f607de2f9ad84dbfaf6
data/README.md CHANGED
@@ -1672,7 +1672,7 @@ not have a `format` set. You can do this by overriding the `default_attribute_op
1672
1672
  resource for a system wide change).
1673
1673
 
1674
1674
  ```ruby
1675
- def default_attribute_options
1675
+ def self.default_attribute_options
1676
1676
  {format: :my_default}
1677
1677
  end
1678
1678
  ```
@@ -126,26 +126,20 @@ module JSONAPI
126
126
  end
127
127
 
128
128
  def ensure_valid_accept_media_type
129
- if invalid_accept_media_type?
129
+ unless valid_accept_media_type?
130
130
  fail JSONAPI::Exceptions::NotAcceptableError.new(request.accept)
131
131
  end
132
132
  rescue => e
133
133
  handle_exceptions(e)
134
134
  end
135
135
 
136
- def invalid_accept_media_type?
136
+ def valid_accept_media_type?
137
137
  media_types = media_types_for('Accept')
138
138
 
139
- return false if media_types.blank? || media_types.include?(ALL_MEDIA_TYPES)
140
-
141
- jsonapi_media_types = media_types.select do |media_type|
142
- media_type.include?(JSONAPI::MEDIA_TYPE)
143
- end
144
-
145
- jsonapi_media_types.size.zero? ||
146
- jsonapi_media_types.none? do |media_type|
147
- media_type == JSONAPI::MEDIA_TYPE
148
- end
139
+ media_types.blank? ||
140
+ media_types.any? do |media_type|
141
+ (media_type == JSONAPI::MEDIA_TYPE || media_type == ALL_MEDIA_TYPES)
142
+ end
149
143
  end
150
144
 
151
145
  def media_types_for(header)
@@ -148,6 +148,7 @@ module JSONAPI
148
148
  source_resource ||= source_klass.find_by_key(source_id, context: context, fields: fields)
149
149
 
150
150
  related_resources = source_resource.public_send(relationship_type,
151
+ context: context,
151
152
  filters: filters,
152
153
  sort_criteria: sort_criteria,
153
154
  paginator: paginator,
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = '0.8.0.beta1'
3
+ VERSION = '0.8.0.beta2'
4
4
  end
5
5
  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.8.0.beta1
4
+ version: 0.8.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-22 00:00:00.000000000 Z
12
+ date: 2016-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler