dor-workflow-service 2.9.0 → 2.10.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
  SHA256:
3
- metadata.gz: a0b888963479c4de1033bd8798b2b0359716cb1ced1eef603dda97368ddc1c24
4
- data.tar.gz: 4453dd238b37050a525f9864d3595385ad271e72d86907006715745b0a704e9c
3
+ metadata.gz: a551f16bb333247b5b41a432f1c9b0fa22767b00fe6d9c2b1268e774c671a0ee
4
+ data.tar.gz: ed7bb2ceaf955c1474a1ce09db561cd695cd2a5c52f8fe3b207c886a4cdcdfda
5
5
  SHA512:
6
- metadata.gz: 2e4121d6d2a23703e28d1f2acaf889afb7ae4990906c0d40134a06343533a3778d006bc8a88e6b0a19974a3e637ec54263b5eedbb427c326ae57fdc4514b33d9
7
- data.tar.gz: 3c7c109f9301ace8b71c61d94ea5d8f4bf2d2fb4397db8e209e3c34e2c195c9ec6398b1a8f6475a3eb993338f81508f4be6f0b863d9d9ae21b04aefb1b1cd27e
6
+ metadata.gz: e9885f3d7e3535bd4b6a074502aac1fe924de902148d53ecaf1375907ddbe013cc3b27fb9a58c3282d94faa8ae70fbb5bdf4099cafe1195909a6900a8c67eba2
7
+ data.tar.gz: 7ee482c8b021948da5563e3118d4f09b2cbe44cceb99ec9333140d701d6f1f6d313edb5a0714540a8b9b3b3fa9db4ebf4b138f092802629ebe0da38b3c2afa15
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-02-01 13:34:49 -0600 using RuboCop version 0.63.1.
3
+ # on 2019-03-12 08:34:30 -0500 using RuboCop version 0.63.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -16,19 +16,19 @@ Lint/UselessAssignment:
16
16
  Exclude:
17
17
  - 'lib/dor/services/workflow_service.rb'
18
18
 
19
- # Offense count: 2
19
+ # Offense count: 1
20
20
  Metrics/AbcSize:
21
21
  Max: 22
22
22
 
23
23
  # Offense count: 1
24
24
  # Configuration parameters: CountComments.
25
25
  Metrics/ClassLength:
26
- Max: 250
26
+ Max: 257
27
27
 
28
- # Offense count: 2
28
+ # Offense count: 3
29
29
  # Configuration parameters: CountComments, ExcludedMethods.
30
30
  Metrics/MethodLength:
31
- Max: 20
31
+ Max: 13
32
32
 
33
33
  # Offense count: 2
34
34
  # Configuration parameters: CountKeywordArgs.
@@ -499,16 +499,7 @@ module Dor
499
499
  end
500
500
  @@http_conn = case url_or_connection
501
501
  when String
502
- Faraday.new(url: url_or_connection) do |faraday|
503
- faraday.response :logger if opts[:debug] # logs to STDOUT
504
- faraday.use Faraday::Response::RaiseError
505
- faraday.adapter :net_http_persistent # use Keep-Alive connections
506
- faraday.options.params_encoder = Faraday::FlatParamsEncoder
507
- if opts.key? :timeout
508
- faraday.options.timeout = opts[:timeout]
509
- faraday.options.open_timeout = opts[:timeout]
510
- end
511
- end
502
+ build_connection(url_or_connection, opts)
512
503
  else
513
504
  url_or_connection
514
505
  end
@@ -521,6 +512,24 @@ module Dor
521
512
 
522
513
  protected
523
514
 
515
+ def build_connection(url, opts)
516
+ Faraday.new(url: url) do |faraday|
517
+ faraday.response :logger if opts[:debug] # logs to STDOUT
518
+ faraday.use Faraday::Response::RaiseError
519
+ faraday.adapter :net_http_persistent # use Keep-Alive connections
520
+ faraday.options.params_encoder = Faraday::FlatParamsEncoder
521
+ if opts.key? :timeout
522
+ faraday.options.timeout = opts[:timeout]
523
+ faraday.options.open_timeout = opts[:timeout]
524
+ end
525
+ faraday.headers[:user_agent] = user_agent
526
+ end
527
+ end
528
+
529
+ def user_agent
530
+ "dor-workflow-service #{Dor::Workflow::Service::VERSION}"
531
+ end
532
+
524
533
  def build_queued_uri(repository, opts = {})
525
534
  uri_string = "workflow_queue/all_queued?repository=#{repository}"
526
535
  uri_string += "&hours-ago=#{opts[:hours_ago]}" if opts[:hours_ago]
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  module Service
6
- VERSION = '2.9.0'
6
+ VERSION = '2.10.0'
7
7
  end
8
8
  end
9
9
  end
@@ -55,12 +55,17 @@ describe Dor::WorkflowService do
55
55
  end
56
56
 
57
57
  describe '#configure' do
58
- it 'should handle a string and timeout' do
59
- conn = Dor::WorkflowService.configure 'http://externalhost/', timeout: 99
58
+ let(:conn) { Dor::WorkflowService.configure 'http://externalhost/', timeout: 99 }
59
+
60
+ it 'has a timeout' do
60
61
  expect(conn).to be_a(Faraday::Connection)
61
62
  expect(conn.options.timeout).to eq(99)
62
63
  expect(conn.options.open_timeout).to eq(99)
63
64
  end
65
+
66
+ it 'has a user_agent' do
67
+ expect(conn.headers).to include('User-Agent' => /dor-workflow-service \d+\.\d+\.\d+/)
68
+ end
64
69
  end
65
70
 
66
71
  describe '#create_workflow' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-workflow-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willy Mene
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-02-07 00:00:00.000000000 Z
12
+ date: 2019-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport