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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 550ecccd333580ddef30e3099faafea449a099ccb958011b7bcd7dd0f6ca60aa
4
- data.tar.gz: 9a21b4250e1c446b45d47fe1f3d996729df4a23ecf5f546c9399a2186529565b
3
+ metadata.gz: 9a452b0b7365491be6624bef197bb981283082079879e0507287ea4067eb4e53
4
+ data.tar.gz: '018d68f064909a03d3a52f3969a706c73642d9493769e215dffcdd026ab9603b'
5
5
  SHA512:
6
- metadata.gz: '08b917c9f53ebd4681baefc92671eeea574353f635bbb5eaa4cbb489db2d036ce9bbcdb863d6c502b0893409bcbc1f028413750210034d1a670073439c113ddb'
7
- data.tar.gz: b011abb7dab8e949234f5dd4f2572023b424af166fcb76bec69111d8d9b39b3fd43ba93be700cf58cf5f646d7198ee2648c0b846e065de5f73bf03a23ebba00e
6
+ metadata.gz: 8ba314e08abbe0f0ea6fc05d559f53cc4397132c7fa2ef88d7c2852a9eb71df75fba2f3adeb8ff8af380891df79cd6af641bffa5cc4449b5ca2ad8282bba3157
7
+ data.tar.gz: d1adc0d6e003fa91a9fe84c89d3c96e85a5868227bb6c2a776ada317dd8aa5ea2f7e0a48339fee44e64252ca969a0e3aafc167f674a8df90f50e733f74672bea
@@ -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 = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
14
- http.request http_request
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
@@ -1,3 +1,3 @@
1
1
  module Funky
2
- VERSION = "0.2.32"
2
+ VERSION = "0.2.33"
3
3
  end
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.32
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-06-07 00:00:00.000000000 Z
11
+ date: 2018-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler