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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dba9125993db728a02e4ea65fb2a9fd6a3599722
4
- data.tar.gz: db96b92a9ad28e1dde4a7704a822d14230064a74
3
+ metadata.gz: da5f44960e6b4d75ee38074cc560afd0eaa2b7f4
4
+ data.tar.gz: 347dd575b73a01e90c96522f367231471ffbc739
5
5
  SHA512:
6
- metadata.gz: 5feb44e6ce0f1fc8f893f4307cefe766a596e88e93f913331460d631cae8a5535a37b76a1ed72ae9973eef9b1f5f4fe9e9103bed619cd8c2685032388ead647e
7
- data.tar.gz: 8e5f792e3aed07bb5fcdfd9af63867acfc83ef23a98c0db3763447452405e910998a0d51e071d8a8b6a01221cc82836d896110d5033371c8a58d811012bd6f4f
6
+ metadata.gz: 5dec62885e75a5ac54f0e0026137f8c12e23e82d4b3af8aba555d6b8e3422bdf5021a330fe782744128658821c564a374cd75c2bc64f20053028d28a0b8222a0
7
+ data.tar.gz: b3de1f611bf4e902868505bde4915632557fb83ddabc5a4b839fa4a7818557032a3253e92ce17bd737d46d73a9be82f662f504870c35f15dc5743bcc52956409
@@ -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
@@ -7,6 +7,9 @@ require "glossyapp/session/pages"
7
7
  require "glossyapp/session/page_elements"
8
8
  require "glossyapp/session/assets"
9
9
 
10
+ # Fix broken patron URL builder
11
+ require "ext/session"
12
+
10
13
 
11
14
  module GlossyApp
12
15
 
@@ -1,3 +1,3 @@
1
1
  module GlossyApp
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
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