excon-addressable 0.2.1 → 0.3.0

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: ddea4379bf9d38fa0d1e62f0e74400ae88b23952
4
- data.tar.gz: e64364df474a846c820d7bd3b7512152eec424c6
3
+ metadata.gz: e558d3d5cb419bdcdeda967aae9565a3ab0d123e
4
+ data.tar.gz: 4735bf832f00703cf2819de2799ab81f8e4d7abc
5
5
  SHA512:
6
- metadata.gz: 841cf19a796b8d421b3b3ad6fbe1cbdeeed813f597766c422deb5eb1803e66e861b79318afa6b5efd29287e903d029f5ca0b79da617a5a69310a80541e979876
7
- data.tar.gz: 6da662f13573254b881cf4dcaa8b3ea4b53ad0856ffa9c99065b13990c746bc2e29b5b56dfd23c6710e1139fbf8476bcf3a1ad6f2ca4ea3170d514d6c91e9bc6
6
+ metadata.gz: ac154d346b4ae2c7e7e765fe66d02ce322776549184dd31256b9b7c80fe4e03223a43eaf3d23968a48ad0945e285e297f8c34335cef75dd0306127d803001747
7
+ data.tar.gz: 056fb5a70162aa72c6e758ed3df9e4559d2da8a7ae8c46b26a6752545cfc76759c611a677268c62531950d9a253769609e5ac25e956ac2b61377b1658cbd7c4a
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Excon
4
+ module Addressable
5
+ # Parser
6
+ #
7
+ # Parses a url using `Addressable`, setting the port to the inferred_port.
8
+ #
9
+ # @see : https://github.com/excon/excon/issues/384#issuecomment-42645517
10
+ #
11
+ class Parser
12
+ def self.parse(url)
13
+ uri = ::Addressable::URI.parse(url)
14
+ uri.port = uri.inferred_port unless uri.port
15
+ uri
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Excon
3
3
  module Addressable
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.0'
5
5
  end
6
6
  end
@@ -2,10 +2,9 @@
2
2
  require 'addressable/template'
3
3
  require 'addressable/uri'
4
4
  require 'excon'
5
+ require 'excon/addressable/parser'
5
6
  require 'excon/addressable/version'
6
7
 
7
- Excon.defaults[:uri_parser] = Addressable::URI
8
-
9
8
  module Excon
10
9
  module Addressable
11
10
  # Middleware
@@ -14,8 +13,9 @@ module Excon
14
13
  #
15
14
  class Middleware < Excon::Middleware::Base
16
15
  def request_call(datum)
17
- url = ::Addressable::URI.new(datum)
16
+ datum[:uri_parser] = Parser
18
17
 
18
+ url = ::Addressable::URI.new(datum)
19
19
  if (template = ::Addressable::Template.new(url)) && template.variables.any?
20
20
  uri = template.expand(datum[:expand].to_h)
21
21
  datum.merge!(uri.to_hash)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon-addressable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-19 00:00:00.000000000 Z
12
+ date: 2016-05-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -126,6 +126,7 @@ files:
126
126
  - Rakefile
127
127
  - excon-addressable.gemspec
128
128
  - lib/excon/addressable.rb
129
+ - lib/excon/addressable/parser.rb
129
130
  - lib/excon/addressable/version.rb
130
131
  - test/excon/addressable_test.rb
131
132
  - test/test_helper.rb