faraday 2.0.0.alpha.pre.3 → 2.0.0.alpha.pre.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: 1c5ab8c9cafcd2690a2ea370814f080f0a085e666377048166868b84a9b3fb7e
4
- data.tar.gz: 399207b7f32439dae2f9ad22bf839479e3cf715001f6b8d8a8fb8f88bb1f565d
3
+ metadata.gz: f77dd46610919ce71119fc9b51f01a0b8d2e5294c279ca4849088d642c72e1d8
4
+ data.tar.gz: 8f6f37724b2f1d730b11f3c9bf2e3440e952e682c7728f9b5adef86a917cd1dc
5
5
  SHA512:
6
- metadata.gz: 0a1b9107707c0f2ad30040885cd0037bf5ea64f3035e28b2cf4c8f0304de8b3acbc9217d6c77b0889a0603909dfaf87a9c54108a0a65e34291d13b69eae8efec
7
- data.tar.gz: 74083d46a172455f40fd28151b806678c4d8f404508f2b25e2a8eb7b08c025a870565467fd5dff2420e2f1ebb01327b09d5519877770f46e0ea7d83c30c15a13
6
+ metadata.gz: 95ed69ec1d3ba8582309cf314c65f3718ee3feff7d15f7e7b75593e23c992c30df5243547618be0ff1bc17da1a346feb72ae5ce7460f10ec086061426270476d
7
+ data.tar.gz: 8d511875d592606eaab5aef9de57c86f083136ab022cb7cc6db56e4676ea9c6fde624378bca18db294f9dd6a0025fd96228baf5c92d93c539fbd7b6a5d2978d9
@@ -8,10 +8,11 @@ module Faraday
8
8
 
9
9
  # @param app [#call]
10
10
  # @param type [String, Symbol] Type of Authorization
11
- # @param params [Array<String, Proc>] parameters to build the Authorization header.
11
+ # @param params [Array<String, Proc, #call>] parameters to build the Authorization header.
12
12
  # If the type is `:basic`, then these can be a login and password pair.
13
13
  # Otherwise, a single value is expected that will be appended after the type.
14
- # This value can be a proc, in which case it will be invoked on each request.
14
+ # This value can be a proc or an object responding to `.call`, in which case
15
+ # it will be invoked on each request.
15
16
  def initialize(app, type, *params)
16
17
  @type = type
17
18
  @params = params
@@ -37,7 +38,7 @@ module Faraday
37
38
  raise ArgumentError, "Unexpected params received (got #{params.size} instead of 1)"
38
39
  else
39
40
  value = params.first
40
- value = value.call if value.is_a?(Proc)
41
+ value = value.call if value.is_a?(Proc) || value.respond_to?(:call)
41
42
  "#{type} #{value}"
42
43
  end
43
44
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Faraday
4
- VERSION = '2.0.0.alpha-3'
4
+ VERSION = '2.0.0.alpha-4'
5
5
  end
@@ -63,6 +63,15 @@ RSpec.describe Faraday::Request::Authorization do
63
63
  include_examples 'does not interfere with existing authentication'
64
64
  end
65
65
 
66
+ context 'when passed a callable' do
67
+ let(:callable) { double('Callable Authorizer', call: 'custom_from_callable') }
68
+ let(:auth_config) { [callable] }
69
+
70
+ it { expect(response.body).to eq('Bearer custom_from_callable') }
71
+
72
+ include_examples 'does not interfere with existing authentication'
73
+ end
74
+
66
75
  context 'when passed too many arguments' do
67
76
  let(:auth_config) { %w[baz foo] }
68
77
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.pre.3
4
+ version: 2.0.0.alpha.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@technoweenie"
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-11-30 00:00:00.000000000 Z
13
+ date: 2021-12-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multipart-post
@@ -137,7 +137,7 @@ licenses:
137
137
  - MIT
138
138
  metadata:
139
139
  homepage_uri: https://lostisland.github.io/faraday
140
- changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.0.0.alpha.pre.3
140
+ changelog_uri: https://github.com/lostisland/faraday/releases/tag/v2.0.0.alpha.pre.4
141
141
  source_code_uri: https://github.com/lostisland/faraday
142
142
  bug_tracker_uri: https://github.com/lostisland/faraday/issues
143
143
  post_install_message: