acfs 0.43.2 → 0.44.0

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: bb6beef716e78e480aedddca7a82b3038c2cdb66
4
- data.tar.gz: 594fabd1f7d3367a69585b5c57756769543ffbf0
3
+ metadata.gz: b6d7af15fe21ff66b382cb23061cfa56cbba0ed5
4
+ data.tar.gz: 3e037d00c80edce80f8578570a526467c54ac943
5
5
  SHA512:
6
- metadata.gz: d8e27c7c86a770e016c1ea57f7f1a38b08e8ab77fa2cc3f6b13dcd8c2abb5c2bbcf32e4c85c4ddd5da05a724e736d16a80b554a834fc77e886284e5141c79e6c
7
- data.tar.gz: 47fc747abc4dcec91a32804c8d6618da3062361ac70bde1ee8f228516e62b3122fd0ee5f930acbe66df7ec06c3a8e9d424cd7df1266b7c2f8ff848496d92663b
6
+ metadata.gz: 00e78fa5cad1bfc7eff302b05ce92d7bd798cd581a132ed293e28fe47254b54fa2da3095862eb51c42250e81c04aa84bc91e5ad8cbf02e92a196eb34797bd840
7
+ data.tar.gz: c690ff3a89317f7a0c488a4752f5d4756bd186cef50306b7bfceff3c07f4b9ca5f4904255aa5ff2ffeecba0783b6d48ad31adae39f595f0a04f740a6cce9f066
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.44.0
4
+
5
+ * Add option to configure adapter creation and pass option to typhoeus adapter e.g.
6
+ limiting concurrency.
7
+
8
+ ## 0.43.2
9
+
10
+ * add `total_count` for paginated collections
11
+
3
12
  ## 0.43.1
4
13
 
5
14
  * Fix `:with` condition matching on stubs
@@ -5,6 +5,10 @@ module Acfs
5
5
  # Adapter for Typhoeus.
6
6
  #
7
7
  class Typhoeus < Base
8
+ def initialize(**kwargs)
9
+ @options = kwargs
10
+ end
11
+
8
12
  def start
9
13
  hydra.run
10
14
  rescue
@@ -25,7 +29,7 @@ module Acfs
25
29
  protected
26
30
 
27
31
  def hydra
28
- @hydra ||= ::Typhoeus::Hydra.new
32
+ @hydra ||= ::Typhoeus::Hydra.new(**@options)
29
33
  end
30
34
 
31
35
  def convert_request(req)
@@ -6,6 +6,7 @@ module Acfs
6
6
  #
7
7
  class Configuration
8
8
  attr_reader :locations
9
+ attr_accessor :adapter
9
10
 
10
11
  # @api private
11
12
  def initialize
@@ -8,7 +8,15 @@ module Acfs
8
8
  # @return [Runner]
9
9
  #
10
10
  def runner
11
- Thread.current[:acfs_runner] ||= Runner.new Adapter::Typhoeus.new
11
+ Thread.current[:acfs_runner] ||= begin
12
+ adapter = Configuration.current.adapter
13
+
14
+ if adapter
15
+ Runner.new adapter.call
16
+ else
17
+ Runner.new Adapter::Typhoeus.new
18
+ end
19
+ end
12
20
  end
13
21
 
14
22
  # @api public
@@ -1,8 +1,8 @@
1
1
  module Acfs
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 43
5
- PATCH = 2
4
+ MINOR = 44
5
+ PATCH = 0
6
6
  STAGE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, STAGE].reject(&:nil?).join('.')
@@ -17,4 +17,12 @@ describe Acfs::Adapter::Typhoeus do
17
17
  expect { adapter.start }.to raise_error(/404\-[12]/)
18
18
  expect { adapter.start }.to_not raise_error
19
19
  end
20
+
21
+ it 'passes arguments to typhoeus hydra' do
22
+ value = {key: 1, key2: 2}
23
+
24
+ expect(::Typhoeus::Hydra).to receive(:new).with(value)
25
+
26
+ described_class.new(**value).send :hydra
27
+ end
20
28
  end
@@ -39,4 +39,13 @@ describe Acfs::Configuration do
39
39
  end
40
40
  end
41
41
  end
42
+
43
+ describe '#adapter' do
44
+ let(:object) { Object.new }
45
+
46
+ it 'should be a accessor' do
47
+ cfg.adapter = object
48
+ expect(cfg.adapter).to eq object
49
+ end
50
+ end
42
51
  end
@@ -72,4 +72,22 @@ describe ::Acfs::Global do
72
72
  Acfs.run
73
73
  end
74
74
  end
75
+
76
+ describe '#runner' do
77
+ it 'returns per-thread runner' do
78
+ runner1 = Thread.new { acfs.runner } .value
79
+ runner2 = Thread.new { acfs.runner } .value
80
+
81
+ expect(runner1).to_not equal runner2
82
+ end
83
+
84
+ it 'uses configurated adapter' do
85
+ adapter = double :adapter
86
+ expect(Acfs::Configuration.current).to receive(:adapter).and_return(-> { adapter })
87
+
88
+ runner = Thread.new { acfs.runner }.value
89
+
90
+ expect(runner.adapter).to equal adapter
91
+ end
92
+ end
75
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.43.2
4
+ version: 0.44.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-04 00:00:00.000000000 Z
11
+ date: 2016-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  version: '0'
228
228
  requirements: []
229
229
  rubyforge_project:
230
- rubygems_version: 2.4.8
230
+ rubygems_version: 2.5.1
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: An abstract API base client for service oriented application.