ezclient 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ezclient/request.rb +11 -2
- data/lib/ezclient/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: e9897ff5dccafb68e0eadf415f8c65b1232d8da91f38c1dbe29bbccc7263939a
|
4
|
+
data.tar.gz: 81a60d20746b3482697f49433aad567361892b98c51705c4fcddae0d7755eb32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecbdc6a0ac6c5221128016c16ad39e1addaad7c8d79cecdb9accdb30e55c458ef39fbdfbaeac05af39ee826033392036770ed93a6375af7a28283dd97f93559d
|
7
|
+
data.tar.gz: 4feb95f5c9de7581c215e23fd1ea2a54cab09cf18e593c04cdeddccc761b02af64b39ce5e33338d9c7bb39fe4ce551f8db6716dd82fb24c5cc38b3c69bb99b0e
|
data/lib/ezclient/request.rb
CHANGED
@@ -68,11 +68,14 @@ class EzClient::Request
|
|
68
68
|
|
69
69
|
def http_request
|
70
70
|
@http_request ||= begin
|
71
|
-
|
72
|
-
|
71
|
+
opts = {}
|
72
|
+
|
73
73
|
opts[verb == "GET" ? :params : :form] = options[:params]
|
74
|
+
opts[:json] = options[:json] if options[:json]
|
75
|
+
opts[:body] = options[:body] if options[:body]
|
74
76
|
opts[:params] = options[:query] if options[:query]
|
75
77
|
opts[:form] = options[:form] if options[:form]
|
78
|
+
opts[:headers] = prepare_headers(options[:headers])
|
76
79
|
|
77
80
|
http_client.build_request(verb, url, opts)
|
78
81
|
end
|
@@ -140,6 +143,12 @@ class EzClient::Request
|
|
140
143
|
options[:max_retries] || 1
|
141
144
|
end
|
142
145
|
|
146
|
+
def prepare_headers(headers)
|
147
|
+
headers = HTTP::Headers.coerce(headers)
|
148
|
+
headers[:user_agent] ||= "ezclient/#{EzClient::VERSION}"
|
149
|
+
headers
|
150
|
+
end
|
151
|
+
|
143
152
|
def basic_auth
|
144
153
|
@basic_auth ||= begin
|
145
154
|
case options[:basic_auth]
|
data/lib/ezclient/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ezclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Smirnov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|