ncore 3.4.1 → 3.4.4

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: 4ad09fd322d7d12373a6546e276cf7d350c4425b273a864c705fc580c10a269c
4
- data.tar.gz: 6fd560c150a0ef389ac40b989c71f8c092f5d88802a1d35851d2bff06ca44d8c
3
+ metadata.gz: 37764b440a06ae592f8c0b536e431a83ade55ebf27503e591325561876acd1de
4
+ data.tar.gz: dd35be93d3d788b55ac6404db24dadc805cee91a87b42485347dd2ea707dee3a
5
5
  SHA512:
6
- metadata.gz: c33362a9a2553c073d449aa58c97d850763e73b15a08fc34e5cf399c7c0043961ecb371fed29df917235fc482e62f8d1a3f944e05c36292253c65d5f5398d426
7
- data.tar.gz: ebdd0b5a3cf136fbce954bbcda99cd2f0fd8cdeedb52347da76f5acf076aac57865d9bf77cc65fcfcb88a48f3390a9722bb9d8704ed24d20c84c7891f88e4a32
6
+ metadata.gz: 2b4a3cec14d91cea9efb6fa947362b9098b212a46102977564060a53b666eff93bcaf1c298e959039597974a729355b92661c4dddd72d03d9353e2e0a249392f
7
+ data.tar.gz: d0255d70bba9e5735373b9af7f22f5348736273cd42aedf03d961ba4e33ff121bd6248efe9cc1df4c6630628154b73ed1315152a9d55c51d8ada6309e18b699a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ #### 3.4.4
2
+
3
+ - Improve keepalive handling
4
+
5
+ #### 3.4.3
6
+
7
+ - Fix Rails controller reporting of API times
8
+
9
+ #### 3.4.2
10
+
11
+ - Fix SomeResource.all when payload includes 'data' attribute
12
+
1
13
  #### 3.4.1
2
14
 
3
15
  - Allow ActiveModel 7.0
@@ -84,6 +96,10 @@ Other changes
84
96
  - #i18n_scope, config via Api.i18n_scope=
85
97
  - #cache_key, #cache_version, #cache_key_with_version
86
98
 
99
+ #### 2.3.2
100
+
101
+ - Allow ActiveSupport 7.0
102
+
87
103
  #### 2.3.1
88
104
 
89
105
  - Allow ActiveModel 6.1
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021 Notioneer, Inc.
1
+ Copyright (c) 2014-2022 Notioneer, Inc.
2
2
 
3
3
  MIT License
4
4
 
@@ -1,7 +1,12 @@
1
1
  module MyApi
2
2
  class Railtie < Rails::Railtie
3
3
 
4
- config.after_initialize do
4
+ config.action_dispatch.rescue_responses.merge!(
5
+ 'MyApi::RecordInvalid' => :unprocessable_entity, # 422
6
+ 'MyApi::RecordNotFound' => :not_found, # 404
7
+ )
8
+
9
+ initializer "my_api.cache_store" do |app|
5
10
  MyApi::Api.cache_store = Rails.cache
6
11
  end
7
12
 
data/lib/ncore/client.rb CHANGED
@@ -177,9 +177,9 @@ module NCore
177
177
  tries += 1
178
178
  response = connection.request rest_opts.except(:url)
179
179
  rescue Excon::Error::Socket, Excon::Errors::SocketError, Excon::Error::Timeout,
180
- Errno::EADDRNOTAVAIL => e
180
+ Errno::EADDRNOTAVAIL, Errno::ECONNRESET => e
181
181
  # retry when keepalive was closed
182
- if tries <= 1 #&& e.message =~ /end of file reached/
182
+ if tries <= 1
183
183
  retry
184
184
  else
185
185
  raise e
@@ -6,11 +6,12 @@ module NCore
6
6
 
7
7
  private
8
8
 
9
+ # only caches GET requests with 200..299, 409, 422 responses
9
10
  # cache_opts: true
10
11
  # use *::Api.cache_store
11
12
  # cache_opts: {...}
12
13
  # use: *::Api.cache_store, with options: {...}
13
- # hint: add force: true execute the query and rewrite the cache
14
+ # hint: add force: true to execute the query and rewrite the cache
14
15
  # cache_opts: Store.new
15
16
  # use Store.new as-is
16
17
  def execute_request(req, cache_opts=nil)
@@ -12,7 +12,7 @@ module NCore
12
12
  Collection.new.tap do |coll|
13
13
  coll.metadata = parsed[:metadata]
14
14
  parsed[:data].each do |hash|
15
- coll << factory(hash.merge(metadata: parsed[:metadata]), creds)
15
+ coll << factory({data: hash, metadata: parsed[:metadata]}, creds)
16
16
  end
17
17
  end
18
18
  end
@@ -108,7 +108,9 @@ module NCore
108
108
  end
109
109
 
110
110
  def register_api_runtime(log_sub, title)
111
- ControllerRuntime.api_runtime_list += [{log_sub: log_sub, title: title, rt: 0}]
111
+ unless ControllerRuntime.api_runtime_list.detect{|arl| arl[:log_sub]==log_sub }
112
+ ControllerRuntime.api_runtime_list += [{log_sub: log_sub, title: title, rt: 0}]
113
+ end
112
114
  end
113
115
  end
114
116
 
data/lib/ncore/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module NCore
2
- VERSION = '3.4.1'
2
+ VERSION = '3.4.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncore
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Notioneer Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2022-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
- rubygems_version: 3.2.15
145
+ rubygems_version: 3.2.32
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: NCore - Gem for building REST API clients