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 +4 -4
- data/lib/excon/addressable/parser.rb +19 -0
- data/lib/excon/addressable/version.rb +1 -1
- data/lib/excon/addressable.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e558d3d5cb419bdcdeda967aae9565a3ab0d123e
|
4
|
+
data.tar.gz: 4735bf832f00703cf2819de2799ab81f8e4d7abc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/excon/addressable.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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
|