json_api_client 1.21.0 → 1.21.1

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
  SHA256:
3
- metadata.gz: 5f4a758332e3d5a88f73ad623771ea645a6c68c4329b6c0f8616fa0a4760e72c
4
- data.tar.gz: 8ad725ee77c0aebdbae7020d37b02e155e272a7e6a33fc475bb80a19f6b23eb2
3
+ metadata.gz: f67e7946b46b9e5f0a0cf9d445d366f990926da3c758a9b86a9d554cdf599e9d
4
+ data.tar.gz: b331bebea3994b2e3a342eab136d6ac4494b6021f3ba030a6813374179f51489
5
5
  SHA512:
6
- metadata.gz: 208619a74a51642c54c6793194ff2178f6c07aa1e4e54b78b0d8a176f55319dbc114900aa09acd536a90d5679538b57bccc825e24fe48e03c67077b7f2b18798
7
- data.tar.gz: 1521db737a029e3b1cdadf22e044c1a7d8ebdbc7171792e7c291df3db7c991a5df7aba786fa593aea6523c6fa2d26231e1cf6e1d87c86c1020fde42f960aaea9
6
+ metadata.gz: babc0059c16c3386935942264968cccd309b7268b130a2170dd2e78669861659c5844c080750cf54e1314357c9c88798a75a63df32f3e29af8400670a4dba43e
7
+ data.tar.gz: 4b9e3b6cbaae50653a896d4fdb02364eb9c34456e721ff8dd1b83e9106c11b502d138721f249b334317b015be791b8102dbb867303855bd54304bec229f01a5e
@@ -46,11 +46,18 @@ module JsonApiClient
46
46
 
47
47
  class NotFound < ClientError
48
48
  attr_reader :uri
49
- def initialize(uri)
50
- @uri = uri
49
+ def initialize(env_or_uri, msg = nil)
50
+ env = nil
51
+
52
+ if env_or_uri.kind_of?(Faraday::Env)
53
+ env = env_or_uri
54
+ @uri = env[:url]
55
+ else
56
+ @uri = env_or_uri
57
+ end
51
58
 
52
- msg = "Resource not found: #{uri.to_s}"
53
- super nil, msg
59
+ msg ||= "Resource not found: #{uri.to_s}"
60
+ super env, msg
54
61
  end
55
62
  end
56
63
 
@@ -24,7 +24,7 @@ module JsonApiClient
24
24
  end
25
25
 
26
26
  grouped_included_set.each do |type, resources|
27
- grouped_included_set[type] = resources.index_by(&:id)
27
+ grouped_included_set[type] = resources.index_by { |resource| resource.attributes[:id] }
28
28
  end
29
29
 
30
30
  @data = grouped_included_set
@@ -37,7 +37,7 @@ module JsonApiClient
37
37
  when 403
38
38
  raise Errors::AccessDenied, env
39
39
  when 404
40
- raise Errors::NotFound, env[:url]
40
+ raise Errors::NotFound, env
41
41
  when 408
42
42
  raise Errors::RequestTimeout, env
43
43
  when 409
@@ -92,7 +92,7 @@ module JsonApiClient
92
92
 
93
93
  def find(args = {})
94
94
  if klass.raise_on_blank_find_param && args.blank?
95
- raise Errors::NotFound, 'blank .find param'
95
+ raise Errors::NotFound, nil, 'blank .find param'
96
96
  end
97
97
 
98
98
  case args
@@ -1,3 +1,3 @@
1
1
  module JsonApiClient
2
- VERSION = "1.21.0"
2
+ VERSION = "1.21.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.21.0
4
+ version: 1.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2023-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubygems_version: 3.0.3
208
+ rubygems_version: 3.3.7
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Build client libraries compliant with specification defined by jsonapi.org