funky 0.2.32 → 0.2.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/funky/connections/base.rb +18 -2
- data/lib/funky/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a452b0b7365491be6624bef197bb981283082079879e0507287ea4067eb4e53
|
|
4
|
+
data.tar.gz: '018d68f064909a03d3a52f3969a706c73642d9493769e215dffcdd026ab9603b'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8ba314e08abbe0f0ea6fc05d559f53cc4397132c7fa2ef88d7c2852a9eb71df75fba2f3adeb8ff8af380891df79cd6af641bffa5cc4449b5ca2ad8282bba3157
|
|
7
|
+
data.tar.gz: d1adc0d6e003fa91a9fe84c89d3c96e85a5868227bb6c2a776ada317dd8aa5ea2f7e0a48339fee44e64252ca969a0e3aafc167f674a8df90f50e733f74672bea
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ For more information about changelogs, check
|
|
|
6
6
|
[Keep a Changelog](http://keepachangelog.com) and
|
|
7
7
|
[Vandamme](http://tech-angels.github.io/vandamme).
|
|
8
8
|
|
|
9
|
+
## 0.2.33 - 2018/10/03
|
|
10
|
+
|
|
11
|
+
* [FEATURE] Add ActiveSupport::Notification based instrumentation.
|
|
12
|
+
|
|
9
13
|
## 0.2.32 - 2018/06/07
|
|
10
14
|
|
|
11
15
|
* [FEATURE] Raise Funky::CountersNotFound error when a video does not have
|
|
@@ -5,14 +5,30 @@ module Funky
|
|
|
5
5
|
|
|
6
6
|
private
|
|
7
7
|
|
|
8
|
+
def self.instrument(uri, request, &block)
|
|
9
|
+
data = {
|
|
10
|
+
request: request,
|
|
11
|
+
method: request.method,
|
|
12
|
+
request_uri: uri
|
|
13
|
+
}
|
|
14
|
+
if defined?(ActiveSupport::Notifications)
|
|
15
|
+
ActiveSupport::Notifications.instrument 'request.funky', data, &block
|
|
16
|
+
else
|
|
17
|
+
block.call(data)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
8
21
|
def self.get_http_request(uri)
|
|
9
22
|
Net::HTTP::Get.new(uri.request_uri)
|
|
10
23
|
end
|
|
11
24
|
|
|
12
25
|
def self.response_for(http_request, uri, max_retries = 5)
|
|
13
|
-
response =
|
|
14
|
-
|
|
26
|
+
response = instrument(uri, http_request) do |data|
|
|
27
|
+
data[:response] = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
|
|
28
|
+
http.request http_request
|
|
29
|
+
end
|
|
15
30
|
end
|
|
31
|
+
|
|
16
32
|
if response.is_a? Net::HTTPSuccess
|
|
17
33
|
response
|
|
18
34
|
elsif response.is_a? Net::HTTPServerError
|
data/lib/funky/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: funky
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.33
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Philip Nguyen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|