Skip to content

Commit

Permalink
Use abstracted #instrument provided by Ldp (#134)
Browse files Browse the repository at this point in the history
ActiveSupport::Notifications#instrument was abstracted previously in the Ldp class to make it an optional include.  This commit uses that instead of creating a hard dependency on ActiveSupport since it isn't specified as a dependency in the gemspec.
  • Loading branch information
cjcolvar committed May 12, 2022
1 parent 1d6eac1 commit 4a42b40
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ldp/client/methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize_http_client *http_client
end

def head url
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "HEAD", ldp_client: object_id) do
resp = http.head do |req|
req.url munge_to_relative_url(url)
Expand All @@ -29,7 +29,7 @@ def head url

# Get a LDP Resource by URI
def get url, options = {}
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "GET", ldp_client: object_id) do
resp = http.get do |req|
req.url munge_to_relative_url(url)
Expand Down Expand Up @@ -57,7 +57,7 @@ def get url, options = {}

# Delete a LDP Resource by URI
def delete url
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "DELETE", ldp_client: object_id) do
resp = http.delete do |req|
req.url munge_to_relative_url(url)
Expand All @@ -70,7 +70,7 @@ def delete url

# Post TTL to an LDP Resource
def post url, body = nil, headers = {}
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "POST", ldp_client: object_id) do
resp = http.post do |req|
req.url munge_to_relative_url(url)
Expand All @@ -84,7 +84,7 @@ def post url, body = nil, headers = {}

# Update an LDP resource with TTL by URI
def put url, body, headers = {}
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "PUT", ldp_client: object_id) do
resp = http.put do |req|
req.url munge_to_relative_url(url)
Expand All @@ -98,7 +98,7 @@ def put url, body, headers = {}

# Update an LDP resource with TTL by URI
def patch url, body, headers = {}
ActiveSupport::Notifications.instrument("http.ldp",
Ldp.instrument("http.ldp",
url: url, name: "PATCH", ldp_client: object_id) do
resp = http.patch do |req|
req.url munge_to_relative_url(url)
Expand Down

0 comments on commit 4a42b40

Please sign in to comment.