we-call 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -14
- data/README.md +3 -32
- data/lib/we/call/version.rb +1 -1
- data/we-call.gemspec +1 -2
- metadata +16 -32
- data/lib/we/call/annotations.rb +0 -36
- data/lib/we/call/deprecated.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f6b6c396092e080b179bf2811abd96992fd7e1a
|
4
|
+
data.tar.gz: f3d35f54e93e60b405e28a732766155d2110d209
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa4b02af461ee342404ba0bd2ef959cbd1728cc89208fa1574fe6510b8daa85e80aa9111fe04729c57124ad2bae0bdaa736bddb800755affa0b484bfa457efe1
|
7
|
+
data.tar.gz: b13a9ecdc979fdddc1d1cd3fd3be82eac6288d9be470e54414c46b3e2f7b39c261a0725a91bab51ab74578581fcade181295cb953e1ce6311057e3b6d7aa82a9
|
data/CHANGELOG.md
CHANGED
@@ -5,46 +5,49 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
-
## v0.
|
8
|
+
## [v0.7.0] - 2017-10-07
|
9
|
+
### Breaking Changes
|
10
|
+
- Removed `We::Call::Deprecated` and `We::Call::Annotations`. Deprecation logic is now handled by [rails-sunset] instead. I fully understand the irony of removing deprecation logic without deprecation
|
11
|
+
|
12
|
+
[rails-sunset]: https://github.com/wework/rails-sunset
|
13
|
+
|
14
|
+
## [v0.6.1] - 2017-10-03
|
9
15
|
### Fixed
|
10
16
|
- Required typhoeus in We::Call instead of connection, which loads it early enough for NewRelic tracing to kick in if you use that
|
11
17
|
|
12
18
|
### Changed
|
13
19
|
- Reduced open timeout default to 1 second
|
14
20
|
|
15
|
-
|
16
|
-
- Reduced open timeout default to 1 second
|
17
|
-
|
18
|
-
## v0.6.0
|
21
|
+
## [v0.6.0]
|
19
22
|
### Changed
|
20
23
|
- Use typhoeus instead of NetHTTP for a [series of reasons]
|
21
24
|
|
22
25
|
[typhoeus]: https://github.com/typhoeus/typhoeus
|
23
26
|
[series of reasons]: https://github.com/wework/we-call-gem/pull/7
|
24
27
|
|
25
|
-
## v0.5.4
|
28
|
+
## [v0.5.4]
|
26
29
|
### Fixed
|
27
30
|
- Connection checks `Rails.env` instead of `ENV['RAILS_ENV']` as most people dont have RAILS_ENV in their `.env` file
|
28
31
|
|
29
|
-
## v0.5.3
|
32
|
+
## [v0.5.3]
|
30
33
|
|
31
34
|
### Fixed
|
32
35
|
- Deprecations were calling a private method and failing
|
33
36
|
|
34
|
-
## v0.5.2
|
37
|
+
## [v0.5.2]
|
35
38
|
|
36
39
|
### Fixed
|
37
40
|
- Made Annotations require "ruby_decorators"
|
38
41
|
|
39
|
-
## v0.5.1
|
42
|
+
## [v0.5.1]
|
40
43
|
|
41
44
|
### Changed
|
42
45
|
- Switched `config.detect_deprecations` from bool to expect `:active_support` or logger instance
|
43
46
|
- Moved `We::Call::Middleware::Client::DetectDeprecations` into its own [faraday-sunset] gem (no BC breaks)
|
44
47
|
|
45
|
-
[faraday-sunset]: https://github.com/
|
48
|
+
[faraday-sunset]: https://github.com/wework/faraday-sunset
|
46
49
|
|
47
|
-
## v0.5.0
|
50
|
+
## [v0.5.0]
|
48
51
|
|
49
52
|
### Added
|
50
53
|
- Configurable `We::Call.configure` which accepts a config block
|
@@ -60,17 +63,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
60
63
|
### Fixed
|
61
64
|
- Switched from manually requiring to using module autoload to reduce memory footprint
|
62
65
|
|
63
|
-
## v0.4.2
|
66
|
+
## [v0.4.2]
|
64
67
|
|
65
68
|
### Fixed
|
66
69
|
- Manually setting `conn.adapter` would result in double adapters (two requests made!)
|
67
70
|
|
68
|
-
## v0.4.1
|
71
|
+
## [v0.4.1]
|
69
72
|
|
70
73
|
### Fixed
|
71
74
|
- Improved support for Faraday 0.8 - 0.9.
|
72
75
|
|
73
|
-
## v0.4.0
|
76
|
+
## [v0.4.0]
|
74
77
|
|
75
78
|
### Added
|
76
79
|
- `We::Call::Connection.new` requires `timeout: 1` where 1 is seconds.
|
data/README.md
CHANGED
@@ -97,32 +97,6 @@ Timeouts can only be provided at initialization of a connection, as they should
|
|
97
97
|
|
98
98
|
As well as `timeout: num_seconds` which can set the entire open/read (essentially the total response time of the server), another optional argument exists for `open_timeout: numseconds`. This is how long We::Call should spend waiting for a vague sign of life from the server, which by default is 1.
|
99
99
|
|
100
|
-
### Deprecations
|
101
|
-
|
102
|
-
We::Call helps with a bunch of things, such as the logic to go on client and server side to handle deprecations, both logging calls made to this servies deprecated endpoints, and alerting services when they make calls to deprecated endpoints.
|
103
|
-
|
104
|
-
Currently this is done using a simple annotation.
|
105
|
-
|
106
|
-
```ruby
|
107
|
-
# app/controllers/api_controller.rb
|
108
|
-
|
109
|
-
extend We::Call::Annotations
|
110
|
-
```
|
111
|
-
|
112
|
-
Then a controller can be annotated as such:
|
113
|
-
|
114
|
-
```ruby
|
115
|
-
# app/controllers/foo_controller.rb
|
116
|
-
|
117
|
-
class FooController < ApiController
|
118
|
-
+We::Call::Deprecated.new(date: '2018-01-07 00:00:00 EDT')
|
119
|
-
def show
|
120
|
-
# ...
|
121
|
-
end
|
122
|
-
end
|
123
|
-
```
|
124
|
-
|
125
|
-
It's as simple as that. This annotation will inject a [Sunset header](https://tools.ietf.org/html/draft-wilde-sunset-header-03) and everyone will know its being deprecated.
|
126
100
|
|
127
101
|
## Middleware
|
128
102
|
|
@@ -130,7 +104,9 @@ It's as simple as that. This annotation will inject a [Sunset header](https://to
|
|
130
104
|
|
131
105
|
**DetectDeprecations**
|
132
106
|
|
133
|
-
Automatically enabled,
|
107
|
+
Automatically enabled, the faraday-sunset middleware will watch for the [Sunset header](https://tools.ietf.org/html/draft-wilde-sunset-header-03) and send warning to `ActiveSupport::Deprecation` if enabled, or to whatever is in `ENV['rake.logger']`.
|
108
|
+
|
109
|
+
[faraday-sunset]: https://github.com/wework/faraday-sunset
|
134
110
|
|
135
111
|
### Server
|
136
112
|
|
@@ -147,19 +123,14 @@ Easy! Check your logs for `user_agent=service-name; app_name=service-name;` The
|
|
147
123
|
## Requirements
|
148
124
|
|
149
125
|
- **Ruby:** v2.2 - v2.4
|
150
|
-
- **Rails:** v4.2 - v5.1
|
151
126
|
- **Faraday:** v0.9 - v0.13
|
152
127
|
|
153
|
-
_For now this gem requires Rails 4.2+ due to some ActiveController functionality we are taking advantage of. Future work will include making this purely rack based._
|
154
128
|
|
155
129
|
## TODO
|
156
130
|
|
157
|
-
- [ ] Support adding href to Deprecate to make a `Link` with rel=sunset as per Sunset RFC draft 03
|
158
|
-
- [ ] Remove Rails as a dependency (soft requirement on `ActiveSupport::Deprecated` is fine)
|
159
131
|
- [x] Split DetectDeprecations into standalone [faraday-sunset] gem
|
160
132
|
- [ ] Work on sane defaults for retries and error raising
|
161
133
|
|
162
|
-
[faraday-sunset]: https://github.com/philsturgeon/faraday-sunset
|
163
134
|
|
164
135
|
## Testing
|
165
136
|
|
data/lib/we/call/version.rb
CHANGED
data/we-call.gemspec
CHANGED
@@ -24,13 +24,12 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "faraday", ">= 0.9.0", "< 1.0"
|
25
25
|
spec.add_dependency "faraday_middleware", '~> 0'
|
26
26
|
spec.add_dependency "faraday-sunset", "~> 0.1.0"
|
27
|
-
spec.add_dependency "ruby_decorators", '~> 0.0'
|
28
|
-
spec.add_dependency "rails", ">= 4.2"
|
29
27
|
|
30
28
|
spec.add_development_dependency "appraisal", "~> 2"
|
31
29
|
spec.add_development_dependency "coveralls", '~> 0.7'
|
32
30
|
spec.add_development_dependency "bundler", "~> 1.14"
|
33
31
|
spec.add_development_dependency "rake", "~> 12.0"
|
32
|
+
spec.add_development_dependency "rails", ">= 4.2"
|
34
33
|
spec.add_development_dependency "rspec", "~> 3.5"
|
35
34
|
spec.add_development_dependency "simplecov", '~> 0.15'
|
36
35
|
spec.add_development_dependency "hashie", "~> 3.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: we-call
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.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-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -72,34 +72,6 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 0.1.0
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: ruby_decorators
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - "~>"
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0.0'
|
82
|
-
type: :runtime
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - "~>"
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0.0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: rails
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '4.2'
|
96
|
-
type: :runtime
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - ">="
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '4.2'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: appraisal
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,6 +128,20 @@ dependencies:
|
|
156
128
|
- - "~>"
|
157
129
|
- !ruby/object:Gem::Version
|
158
130
|
version: '12.0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rails
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '4.2'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '4.2'
|
159
145
|
- !ruby/object:Gem::Dependency
|
160
146
|
name: rspec
|
161
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,10 +221,8 @@ files:
|
|
235
221
|
- bin/setup
|
236
222
|
- lib/we-call.rb
|
237
223
|
- lib/we/call.rb
|
238
|
-
- lib/we/call/annotations.rb
|
239
224
|
- lib/we/call/configuration.rb
|
240
225
|
- lib/we/call/connection.rb
|
241
|
-
- lib/we/call/deprecated.rb
|
242
226
|
- lib/we/call/middleware.rb
|
243
227
|
- lib/we/call/middleware/server.rb
|
244
228
|
- lib/we/call/middleware/server/log_user_agent.rb
|
data/lib/we/call/annotations.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require "ruby_decorators"
|
2
|
-
|
3
|
-
module We
|
4
|
-
module Call
|
5
|
-
module Annotations
|
6
|
-
# Enable annotations
|
7
|
-
include RubyDecorators
|
8
|
-
|
9
|
-
def self.extended(base)
|
10
|
-
base.class_eval do
|
11
|
-
# TODO Maybe this after_action could be a really simple call in base controllers
|
12
|
-
# Having it here obviously ties We::Call to Rails, and is probably more than the annotations
|
13
|
-
# class should be doing
|
14
|
-
after_action do |controller|
|
15
|
-
|
16
|
-
# TODO Maybe controller.class and params action could be passed to something in We::Call::Deprecated
|
17
|
-
klass = controller.class
|
18
|
-
method = params['action']
|
19
|
-
deprecation = We::Call::Deprecated.get("#{klass}##{method}")
|
20
|
-
|
21
|
-
if deprecation.present?
|
22
|
-
# Shove a deprecation warning into the console or wherever it goes
|
23
|
-
if defined? ActiveSupport
|
24
|
-
ActiveSupport::Deprecation.warn("#{klass}##{method} is deprecated for removal on #{deprecation[:date].iso8601}")
|
25
|
-
end
|
26
|
-
|
27
|
-
# Shove a Sunset header into HTTP Response for clients to sniff on
|
28
|
-
# https://tools.ietf.org/html/draft-wilde-sunset-header-03
|
29
|
-
response.headers['Sunset'] = deprecation[:date].httpdate
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/we/call/deprecated.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
require "ruby_decorators"
|
2
|
-
|
3
|
-
module We
|
4
|
-
module Call
|
5
|
-
class Deprecated < RubyDecorator
|
6
|
-
class << self
|
7
|
-
def methods
|
8
|
-
@methods ||= {}
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(date:)
|
13
|
-
@date = date
|
14
|
-
end
|
15
|
-
|
16
|
-
def set(method, value)
|
17
|
-
self.class.methods[method] = value
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.get(method)
|
21
|
-
methods[method]
|
22
|
-
end
|
23
|
-
|
24
|
-
# Called when annotation is used
|
25
|
-
def call(this, *args, &blk)
|
26
|
-
set("#{this.owner}##{this.name}", date: normalize_datetime(@date))
|
27
|
-
this.call(*args, &blk)
|
28
|
-
end
|
29
|
-
|
30
|
-
protected
|
31
|
-
|
32
|
-
def normalize_datetime(datetime)
|
33
|
-
datetime = DateTime.parse(datetime) if datetime.is_a? String
|
34
|
-
datetime = datetime.to_datetime if datetime.respond_to? :to_datetime
|
35
|
-
return datetime if datetime.respond_to? :httpdate
|
36
|
-
raise TypeError, 'The date should be a Date, DateTime, Time or string containing a valid date and time'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|