http_api_client 0.1.4 → 0.1.5
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 +8 -8
- data/README.md +3 -0
- data/lib/http_api_client.rb +20 -1
- data/lib/http_api_client/client.rb +3 -3
- data/lib/http_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWRkMGU2ZjI2YjVjMTA1ODJhMjhiYjI0ZDQxMGRlZjRhMDYwY2FjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDFjZjk2NjlkYmY5MjUxMzk5MzFkNGZiNTQxNWI5Yzc4YzFlYjFlMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzNiZmQ5M2Y2OGVlZDQwYjkyYTcwNDE5ZWJjMTA1NzM3NzJiNThlZjBkZWJm
|
10
|
+
NmFmNWUwNjIzMzUyNmY0ODU3NTY0Y2I2Y2VkZmI3MTU3MGM1YTllNmUxOGIx
|
11
|
+
NWFlYjIwYTI0MmY5ODQ1OTNhOWNkMDVjZWZlYzcwZDhmYWVjNzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQwMzk0ZTFhN2JlNzA4ZTFhOGRjMjZkMGEzZjE4YTBlYjQ3NjYyNmNhZDBk
|
14
|
+
ODhhNGIyNmJmZTViYzA0YmM4NTE5NjBmM2M5ZTVkMDJiZDhiMWEzM2RhNzEx
|
15
|
+
YjQwMjRkMWNhNjVkN2Q3ZmE4NjRiZmMxMWFiZGY5ZWVkNzc4Yjc=
|
data/README.md
CHANGED
@@ -156,3 +156,6 @@ This will install `/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt`
|
|
156
156
|
### 0.1.3 - 2014-04-07
|
157
157
|
* Fix issue with adding a nil request id when a client is configured to add header to requests
|
158
158
|
|
159
|
+
### 0.1.4 - 2014-04-07
|
160
|
+
* Don't url encode log values
|
161
|
+
|
data/lib/http_api_client.rb
CHANGED
@@ -31,11 +31,22 @@ module HttpApiClient
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
#Allow it to be injected on app startup. Eg. if using log4r etc
|
35
34
|
def self.logger=(logger)
|
36
35
|
@logger = logger
|
37
36
|
end
|
38
37
|
|
38
|
+
def self.metrics
|
39
|
+
if @metrics
|
40
|
+
@metrics
|
41
|
+
else
|
42
|
+
StubMetrics
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.metrics=(metrics)
|
47
|
+
@metrics = metrics
|
48
|
+
end
|
49
|
+
|
39
50
|
def self.params_encoder
|
40
51
|
if rails
|
41
52
|
RailsParamsEncoder
|
@@ -71,4 +82,12 @@ module HttpApiClient
|
|
71
82
|
end
|
72
83
|
|
73
84
|
end
|
85
|
+
|
86
|
+
class StubMetrics
|
87
|
+
|
88
|
+
def self.time(event_name, data, &block)
|
89
|
+
yield
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
74
93
|
end
|
@@ -43,7 +43,7 @@ module HttpApiClient
|
|
43
43
|
|
44
44
|
log_data = { method: 'get', remote_host: config.server, path: path_with_query(path, query) }
|
45
45
|
|
46
|
-
response =
|
46
|
+
response = HttpApiClient.metrics.time('http_api_client_request', log_data) do
|
47
47
|
connection.get(full_path(path), with_auth(query), request_headers(get_headers, custom_headers))
|
48
48
|
end
|
49
49
|
|
@@ -54,7 +54,7 @@ module HttpApiClient
|
|
54
54
|
|
55
55
|
log_data = { method: 'post', remote_host: config.server, path: full_path(path) }
|
56
56
|
|
57
|
-
response =
|
57
|
+
response = HttpApiClient.metrics.time('http_api_client_request', log_data) do
|
58
58
|
connection.post(full_path(path), JSON.fast_generate(with_auth(payload)), request_headers(update_headers, custom_headers))
|
59
59
|
end
|
60
60
|
|
@@ -66,7 +66,7 @@ module HttpApiClient
|
|
66
66
|
path = "#{base_path}/#{id}"
|
67
67
|
log_data = { method: 'delete', remote_host: config.server, path: full_path(path) }
|
68
68
|
|
69
|
-
response =
|
69
|
+
response = HttpApiClient.metrics.time('http_api_client_request', log_data) do
|
70
70
|
connection.delete(full_path(path), request_headers(update_headers, custom_headers))
|
71
71
|
end
|
72
72
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Monie
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2014-04-
|
14
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|