we-call 0.6.0.pre.alpha.1 → 0.6.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: 5c34caa46ddb44d604811424673ceb22a81f7632
4
- data.tar.gz: c4a42d7fe0b6035e06d044e1427f9c23b8919318
3
+ metadata.gz: 3d78d029728e8e0fa159897a40a4e618127f8baa
4
+ data.tar.gz: 7d19119651d934580795b9ae0f94a758048406cd
5
5
  SHA512:
6
- metadata.gz: '083bc9fc18509c2c11a36a0fd0ec523371a3fa1c026a70052a6cde4e1442e167ab1bc2257a443e4354e4fbf665bed800556b941c77b039ba7aa6d690c25afa14'
7
- data.tar.gz: 267e738a3f870802ce4e7c8bc4a9599ecafa672bb0b8181f0fc2909c70c6c40937d6a8dc378eb9df9686481405644cfc148088def40053107ae0d04677c32849
6
+ metadata.gz: f5f90f915b325d61ccdfc43c896e4b4354d83a1ba47deade642411ab89316159c56ceda5aeda2813e223d3f5eb769e5e298155bbf632430d870a72110c683451
7
+ data.tar.gz: a1952d2146232bb7f6a78d78394bed9b48d8b82f1bbfbba681dcd17b1495b3d54001456e30ba32608bb311bd953f4321773e50978e945c8818176a6b2fe93ae9
data/README.md CHANGED
@@ -157,7 +157,6 @@ _For now this gem requires Rails 4.2+ due to some ActiveController functionality
157
157
  - [ ] Support adding href to Deprecate to make a `Link` with rel=sunset as per Sunset RFC draft 03
158
158
  - [ ] Remove Rails as a dependency (soft requirement on `ActiveSupport::Deprecated` is fine)
159
159
  - [x] Split DetectDeprecations into standalone [faraday-sunset] gem
160
- - [ ] Pass Trace IDs along
161
160
  - [ ] Work on sane defaults for retries and error raising
162
161
 
163
162
  [faraday-sunset]: https://github.com/philsturgeon/faraday-sunset
@@ -167,12 +166,12 @@ _For now this gem requires Rails 4.2+ due to some ActiveController functionality
167
166
  To run tests and modify locally, you'll want to `bundle install` in this directory.
168
167
 
169
168
  ```
170
- bundle exec rspec
169
+ bundle exec appraisal rspec
171
170
  ```
172
171
 
173
172
  ## Development
174
173
 
175
- If you want to test this gem within an application, update your Gemfile to have something like this: `gem 'we-call', github: 'wework/we-call', branch: 'BRANCHNAME'` and set your local config: `bundle config --local local.we-call path/to/we-call`
174
+ If you want to test this gem within an application, update your Gemfile to have something like this: `gem 'we-call', github: 'wework/we-call-gem', branch: 'BRANCHNAME'` and set your local config: `bundle config --local local.we-call path/to/we-call-gem`
176
175
 
177
176
  Simply revert the Gemfile change (updating the version as necessary!) and remove the config with `bundle config --delete local.we-call`.
178
177
 
@@ -1,5 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'faraday-sunset'
3
+ require 'typhoeus'
4
+ require 'typhoeus/adapters/faraday'
3
5
 
4
6
  module We
5
7
  module Call
@@ -8,14 +10,17 @@ module We
8
10
 
9
11
  OPEN_TIMEOUT = 2
10
12
 
13
+ # We use typhoeus instead of default NetHTTP so we can control how many retries are made
14
+ # https://github.com/lostisland/faraday/issues/612
15
+ DEFAULT_ADAPTER_CLASS = Faraday::Adapter::Typhoeus
16
+ DEFAULT_ADAPTER = :typhoeus
17
+
11
18
  class MissingApp < ArgumentError; end
12
19
  class MissingEnv < ArgumentError; end
13
20
  class MissingTimeout < ArgumentError; end
14
21
  class MissingOpenTimeout < ArgumentError; end
15
22
 
16
- parent_builder_class = defined?(Faraday::RackBuilder) ? Faraday::RackBuilder : Faraday::Builder
17
-
18
- QueryableBuilder = Class.new(parent_builder_class) do
23
+ QueryableBuilder = Class.new(Faraday::RackBuilder) do
19
24
  def adapter?
20
25
  @has_adapter || false
21
26
  end
@@ -49,20 +54,25 @@ module We
49
54
  def create
50
55
  builder = QueryableBuilder.new(&Proc.new { |_| })
51
56
 
52
- Faraday.new(url: host, builder: builder) do |faraday|
53
- faraday.headers['User-Agent'] = app
54
- faraday.headers[config.app_name_header] = app
55
- faraday.headers[config.app_env_header] = env
56
- faraday.options[:timeout] = timeout
57
- faraday.options[:open_timeout] = open_timeout
57
+ headers = {
58
+ 'User-Agent' => app,
59
+ config.app_name_header => app,
60
+ config.app_env_header => env,
61
+ }
62
+
63
+ request = {
64
+ timeout: timeout,
65
+ open_timeout: open_timeout
66
+ }
58
67
 
68
+ Faraday.new(host, builder: builder, headers: headers, request: request) do |faraday|
59
69
  if config.detect_deprecations
60
70
  faraday.response :sunset, setup_sunset_middleware(faraday)
61
71
  end
62
72
 
63
73
  yield faraday if block_given?
64
74
 
65
- faraday.adapter Faraday.default_adapter unless faraday.builder.adapter?
75
+ faraday.adapter DEFAULT_ADAPTER unless faraday.builder.adapter?
66
76
  end
67
77
  end
68
78
 
@@ -1,5 +1,5 @@
1
1
  module We
2
2
  module Call
3
- VERSION = "0.6.0-alpha.1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.bindir = "bin"
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "faraday", ">= 0.9.0", "< 0.14"
23
+ spec.add_dependency "typhoeus", "~> 1.3"
24
+ spec.add_dependency "faraday", ">= 0.9.0", "< 1.0"
24
25
  spec.add_dependency "faraday_middleware", '~> 0'
25
26
  spec.add_dependency "faraday-sunset", "~> 0.1.0"
26
27
  spec.add_dependency "ruby_decorators", '~> 0.0'
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: we-call
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.pre.alpha.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WeWork Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-01 00:00:00.000000000 Z
11
+ date: 2017-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: faraday
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -19,7 +33,7 @@ dependencies:
19
33
  version: 0.9.0
20
34
  - - "<"
21
35
  - !ruby/object:Gem::Version
22
- version: '0.14'
36
+ version: '1.0'
23
37
  type: :runtime
24
38
  prerelease: false
25
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +43,7 @@ dependencies:
29
43
  version: 0.9.0
30
44
  - - "<"
31
45
  - !ruby/object:Gem::Version
32
- version: '0.14'
46
+ version: '1.0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: faraday_middleware
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -245,9 +259,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
259
  version: '0'
246
260
  required_rubygems_version: !ruby/object:Gem::Requirement
247
261
  requirements:
248
- - - ">"
262
+ - - ">="
249
263
  - !ruby/object:Gem::Version
250
- version: 1.3.1
264
+ version: '0'
251
265
  requirements: []
252
266
  rubyforge_project:
253
267
  rubygems_version: 2.6.8