glossyapp 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ext/session.rb +43 -0
- data/lib/glossyapp/session.rb +3 -0
- data/lib/glossyapp/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da5f44960e6b4d75ee38074cc560afd0eaa2b7f4
|
4
|
+
data.tar.gz: 347dd575b73a01e90c96522f367231471ffbc739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dec62885e75a5ac54f0e0026137f8c12e23e82d4b3af8aba555d6b8e3422bdf5021a330fe782744128658821c564a374cd75c2bc64f20053028d28a0b8222a0
|
7
|
+
data.tar.gz: b3de1f611bf4e902868505bde4915632557fb83ddabc5a4b839fa4a7818557032a3253e92ce17bd737d46d73a9be82f662f504870c35f15dc5743bcc52956409
|
data/lib/ext/session.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
module Patron
|
2
|
+
class Session
|
3
|
+
|
4
|
+
# Build a request object that can be used in +handle_request+
|
5
|
+
def build_request(action, url, headers, options = {})
|
6
|
+
# If the Expect header isn't set uploads are really slow
|
7
|
+
headers['Expect'] ||= ''
|
8
|
+
|
9
|
+
Request.new.tap do |req|
|
10
|
+
req.action = action
|
11
|
+
req.headers = self.headers.merge headers
|
12
|
+
req.timeout = options.fetch :timeout, self.timeout
|
13
|
+
req.connect_timeout = options.fetch :connect_timeout, self.connect_timeout
|
14
|
+
req.max_redirects = options.fetch :max_redirects, self.max_redirects
|
15
|
+
req.username = options.fetch :username, self.username
|
16
|
+
req.password = options.fetch :password, self.password
|
17
|
+
req.proxy = options.fetch :proxy, self.proxy
|
18
|
+
req.proxy_type = options.fetch :proxy_type, self.proxy_type
|
19
|
+
req.auth_type = options.fetch :auth_type, self.auth_type
|
20
|
+
req.insecure = options.fetch :insecure, self.insecure
|
21
|
+
req.ssl_version = options.fetch :ssl_version, self.ssl_version
|
22
|
+
req.cacert = options.fetch :cacert, self.cacert
|
23
|
+
req.ignore_content_length = options.fetch :ignore_content_length, self.ignore_content_length
|
24
|
+
req.buffer_size = options.fetch :buffer_size, self.buffer_size
|
25
|
+
req.multipart = options[:multipart]
|
26
|
+
req.upload_data = options[:data]
|
27
|
+
req.file_name = options[:file]
|
28
|
+
|
29
|
+
base_url = self.base_url.to_s
|
30
|
+
url = url.to_s
|
31
|
+
raise ArgumentError, "Empty URL" if base_url.empty? && url.empty?
|
32
|
+
uri = URI.parse(base_url.empty? ? url : File.join(base_url, url))
|
33
|
+
query = uri.query.to_s.split('&')
|
34
|
+
query += options[:query].is_a?(Hash) ? Util.build_query_pairs_from_hash(options[:query]) : options[:query].to_s.split('&')
|
35
|
+
uri.query = query.join('&')
|
36
|
+
uri.query = nil if uri.query.empty?
|
37
|
+
url = uri.to_s
|
38
|
+
req.url = url
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
data/lib/glossyapp/session.rb
CHANGED
data/lib/glossyapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glossyapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Schmid
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- bin/console
|
96
96
|
- bin/setup
|
97
97
|
- glossyapp.gemspec
|
98
|
+
- lib/ext/session.rb
|
98
99
|
- lib/glossyapp.rb
|
99
100
|
- lib/glossyapp/session.rb
|
100
101
|
- lib/glossyapp/session/assets.rb
|