json_api_client 1.20.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: 399ea138115c4282afb7f24a8c6981533fc0e67d3e80078084002b8ab8cec5bd
4
- data.tar.gz: aa737c7689874c8aef404b6aeabee2173b2294178486963928a2690495def95a
3
+ metadata.gz: f67e7946b46b9e5f0a0cf9d445d366f990926da3c758a9b86a9d554cdf599e9d
4
+ data.tar.gz: b331bebea3994b2e3a342eab136d6ac4494b6021f3ba030a6813374179f51489
5
5
  SHA512:
6
- metadata.gz: 32657956fe3e7fc03e54d41c434a169613ee490684354cf1d59d864247743197de0858360a4d9e3f3003d073773563775bc8ca70a43be3948acb1c0557bd798c
7
- data.tar.gz: 7aafe127cdc28013bf01e527c98b57f151004b49a5b9a482f12cd03ccce00b60e831c8aab80545651e4712ccb1a5f22bd04b157476503b01ab5ab20e4537750b
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.20.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.20.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: 2021-09-08 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
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 0.15.2
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: 1.2.0
36
+ version: '2.0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 0.15.2
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: 1.2.0
46
+ version: '2.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday_middleware
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  version: 0.9.0
54
54
  - - "<"
55
55
  - !ruby/object:Gem::Version
56
- version: 1.2.0
56
+ version: '2.0'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  version: 0.9.0
64
64
  - - "<"
65
65
  - !ruby/object:Gem::Version
66
- version: 1.2.0
66
+ version: '2.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: addressable
69
69
  requirement: !ruby/object:Gem::Requirement
@@ -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