faraday-log-subscriber 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -18
- data/lib/faraday/controller_runtime.rb +5 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2fbdc08f802375c00f7e51d146438c5eaba500
|
4
|
+
data.tar.gz: c1941d984cbecbcb6c25d74de7f768b90b311d4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f064e0c4fffb36073c59ee0a4ad51da1305c9d7e58fde394f7f9af0be2e0f5b531307aa5b93317a1f01c7aceac6d016fffcc00d50243f8c2385e400f7d9db6a
|
7
|
+
data.tar.gz: 7e40b22ac4c5999d233ffca8528d9c6e9e202163fb2605c3a16d9a2961876cce9b8e8eaac9abb5f621f6468716dd0dc597ba0f068c9f97cf635afd9739ca711f
|
data/README.md
CHANGED
@@ -1,36 +1,49 @@
|
|
1
|
-
# Faraday
|
1
|
+
# Faraday Log Subscriber
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
A `ActiveSupport::LogSubscriber` to log HTTP requests made by a [Faraday](https://github.com/lostisland/faraday) client instance.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
Add
|
7
|
+
Add it to your Gemfile:
|
10
8
|
|
11
9
|
```ruby
|
12
10
|
gem 'faraday-log-subscriber'
|
13
11
|
```
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
13
|
+
## Usage
|
20
14
|
|
21
|
-
|
15
|
+
You have to use the `:instrumentation` middleware from [`faraday_middleware`](https://github.com/lostisland/faraday_middleware) to
|
16
|
+
instrument your requests.
|
22
17
|
|
23
|
-
|
18
|
+
```ruby
|
19
|
+
client = Faraday.new('https://api.github.com') do |builder|
|
20
|
+
builder.use :instrumentation
|
21
|
+
builder.adapter :net_http
|
22
|
+
end
|
24
23
|
|
25
|
-
|
24
|
+
client.get('repos/rails/rails')
|
25
|
+
# 'Faraday GET [200] (1026.9ms) https://api.github.com/repos/rails/rails'
|
26
|
+
```
|
26
27
|
|
27
|
-
|
28
|
+
### `faraday-http-cache` integration
|
28
29
|
|
29
|
-
|
30
|
+
If you use the [`faraday-http-cache`](https://github.com/plataformatec/faraday-http-cache) gem, an extra line will be logged regarding
|
31
|
+
the cache status of the requested URL:
|
30
32
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
33
|
|
33
|
-
|
34
|
+
```ruby
|
35
|
+
client = Faraday.new('https://api.github.com') do |builder|
|
36
|
+
builder.use :instrumentation
|
37
|
+
builder.use :http_cache, instrumenter: ActiveSupport::Notifications
|
38
|
+
builder.adapter :net_http
|
39
|
+
end
|
40
|
+
|
41
|
+
client.get('repos/rails/rails')
|
42
|
+
client.get('repos/rails/rails')
|
43
|
+
# Faraday HTTP Cache [fresh] https://api.github.com/repos/rails/rails
|
44
|
+
# Faraday GET [200] (1.7ms) https://api.github.com/repos/rails/rails
|
45
|
+
```
|
34
46
|
|
35
|
-
|
47
|
+
## License
|
36
48
|
|
49
|
+
Copyright (c) 2015 Plataformatec. See LICENSE file.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faraday-log-subscriber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Mazza
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: actionpack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
142
|
+
rubygems_version: 2.5.1
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: A Log Subscriber for Faraday clients
|