excon-addressable 0.3.1 → 0.4.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: 5f783d23a751f2dc5ac034dfd44b9a844d6d2b7e
4
- data.tar.gz: 72b98745c8e1d4187d3028f15fc95a11d15b0912
3
+ metadata.gz: ed1374c19ccc1979e364969ea6262bf59deb2846
4
+ data.tar.gz: f461e8ba6d7648e9a1cc9d723e84c9a7f87a901e
5
5
  SHA512:
6
- metadata.gz: fcee4d5a86b61d289ae9af021a5a7b980edfad4443e22dbe13c8f16f55adb3a218539590ffd34e605d62860f0ac7fab75a82172d908a79d52025b4988ef2be7e
7
- data.tar.gz: 6b348aefebe8e64622ae9ac04d2d6fb8d45e73257be29fb183132fd1bab7d2e1aa6bbcd933b9d4bb9c0c25efd5cb9d6dfe8814edae2378510dd6aa5e47d83860
6
+ metadata.gz: 537126c71f20fbbca455843a6ed84d912332af53818214c99edb40659c6d4776ed5aa3639eb935017b816a97ae34e6d074a0febd3e09a104aa40002b44be3086
7
+ data.tar.gz: 97d46512f7f90a1805059f60440d8ad7faa15b908501223ac1f5cc4191bda123e925c67d91879f15ce40edf7f5af9dd48932bb40620e523b55ffeffda5e3a0e6
data/.wercker.yml CHANGED
@@ -1,4 +1,4 @@
1
- box: ruby:2.3
1
+ box: ruby:2.5
2
2
  build:
3
3
  steps:
4
4
  - bundle-install
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  source 'https://rubygems.org'
3
4
  gemspec
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rake/testtask'
4
5
  require 'rubocop/rake_task'
5
6
 
6
7
  RuboCop::RakeTask.new do |t|
7
- t.options = %w(--display-cop-names --extra-details --display-style-guide)
8
+ t.options = %w[--display-cop-names --extra-details --display-style-guide]
8
9
  end
9
10
 
10
11
  Rake::TestTask.new(:test) do |t|
@@ -13,4 +14,4 @@ Rake::TestTask.new(:test) do |t|
13
14
  t.test_files = FileList['test/**/*_test.rb']
14
15
  end
15
16
 
16
- task default: %i(test rubocop)
17
+ task default: %i[test rubocop]
@@ -1,5 +1,5 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
2
+
3
3
  lib = File.expand_path('../lib', __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'excon/addressable/version'
@@ -7,22 +7,22 @@ require 'excon/addressable/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'excon-addressable'
9
9
  spec.version = Excon::Addressable::VERSION
10
- spec.authors = %w(Jean Mertz)
11
- spec.email = %w(jean@mertz.fm)
10
+ spec.authors = %w[Jean Mertz]
11
+ spec.email = %w[jean@mertz.fm]
12
12
 
13
13
  spec.summary = 'Excon, with Addressable baked in.'
14
14
  spec.description = 'Excon, with Addressable baked in.'
15
15
  spec.homepage = 'https://github.com/JeanMertz/excon-addressable'
16
16
  spec.license = 'MIT'
17
17
  spec.files = `git ls-files -z`.split("\x0")
18
- spec.require_paths = %w(lib)
18
+ spec.require_paths = %w[lib]
19
19
 
20
- spec.add_development_dependency 'bundler', '~> 1.12'
21
- spec.add_development_dependency 'rake', '~> 10.0'
22
- spec.add_development_dependency 'minitest', '~> 5.0'
23
- spec.add_development_dependency 'rubocop', '~> 0.40'
24
- spec.add_development_dependency 'pry', '~> 0.10'
20
+ spec.add_development_dependency 'bundler', '~> 1.16'
21
+ spec.add_development_dependency 'minitest', '~> 5.11'
22
+ spec.add_development_dependency 'pry', '~> 0.11'
23
+ spec.add_development_dependency 'rake', '~> 12.3'
24
+ spec.add_development_dependency 'rubocop', '~> 0.52'
25
25
 
26
- spec.add_dependency 'excon', '~> 0.49'
27
- spec.add_dependency 'addressable', '~> 2.3'
26
+ spec.add_dependency 'addressable', '~> 2.5'
27
+ spec.add_dependency 'excon', '~> 0.60'
28
28
  end
@@ -7,6 +7,7 @@ module Excon
7
7
  # Parses a url using `Addressable`, setting the port to the inferred_port.
8
8
  #
9
9
  # @see : https://github.com/excon/excon/issues/384#issuecomment-42645517
10
+ # @see : https://github.com/excon/excon/issues/384#issuecomment-362618298
10
11
  #
11
12
  class Parser
12
13
  def self.parse(url)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Excon
3
4
  module Addressable
4
- VERSION = '0.3.1'
5
+ VERSION = '0.4.0'
5
6
  end
6
7
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'addressable/template'
3
4
  require 'addressable/uri'
4
5
  require 'excon'
@@ -7,7 +8,15 @@ require 'excon/addressable/version'
7
8
 
8
9
  Excon.defaults[:uri_parser] = Excon::Addressable::Parser
9
10
 
11
+ # Excon
12
+ #
13
+ # We inject the `expand` key to the allowed lists of keys to be used when
14
+ # creating a request, or connection object. Excon does not enforce this yet, but
15
+ # it does print a warning, so this makes things future-proof.
10
16
  module Excon
17
+ VALID_REQUEST_KEYS << :expand
18
+ VALID_CONNECTION_KEYS << :expand
19
+
11
20
  module Addressable
12
21
  # Middleware
13
22
  #
@@ -15,6 +24,11 @@ module Excon
15
24
  #
16
25
  class Middleware < Excon::Middleware::Base
17
26
  def request_call(datum)
27
+ # we need to convert a query hash (or string) to the proper format for
28
+ # Addressable to work with. We also need to remove the `?` character
29
+ # that Excon prepends to the final query string.
30
+ datum[:query] = Excon::Utils.query_string(datum)[1..-1]
31
+
18
32
  url = ::Addressable::URI.new(datum)
19
33
 
20
34
  if (template = ::Addressable::Template.new(url)) && template.variables.any?
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require_relative '../test_helper'
3
4
 
4
5
  module Excon
@@ -13,6 +14,7 @@ module Excon
13
14
  Excon.stub({ path: '/' }, body: 'index')
14
15
  Excon.stub({ path: '/hello' }, body: 'world')
15
16
  Excon.stub({ path: '/hello', query: 'message=world' }, body: 'hi!')
17
+ Excon.stub({ path: '/hello', query: 'a=b&c=d' }, body: 'earth')
16
18
  Excon.stub({ path: '/world' }, body: 'universe')
17
19
  end
18
20
 
@@ -50,6 +52,24 @@ module Excon
50
52
  assert_equal 'hi!', response.body
51
53
  end
52
54
 
55
+ def test_uri_with_full_uri
56
+ response = Excon.get('http://www.example.com/hello?message=world')
57
+
58
+ assert_equal 'hi!', response.body
59
+ end
60
+
61
+ def test_uri_with_query
62
+ response = Excon.get('http://www.example.com/hello', query: { message: 'world' })
63
+
64
+ assert_equal 'hi!', response.body
65
+ end
66
+
67
+ def test_uri_with_multiple_queries
68
+ response = Excon.get('https://www.example.com/hello', query: { a: 'b', c: 'd' })
69
+
70
+ assert_equal 'earth', response.body
71
+ end
72
+
53
73
  def teardown
54
74
  Excon.stubs.clear
55
75
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
3
4
  require 'excon/addressable'
4
5
  require 'minitest/autorun'
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.3.1
4
+ version: 0.4.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-21 00:00:00.000000000 Z
12
+ date: 2018-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,98 +17,98 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.12'
20
+ version: '1.16'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.12'
27
+ version: '1.16'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
34
+ version: '5.11'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '10.0'
41
+ version: '5.11'
42
42
  - !ruby/object:Gem::Dependency
43
- name: minitest
43
+ name: pry
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '5.0'
48
+ version: '0.11'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '5.0'
55
+ version: '0.11'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rubocop
57
+ name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.40'
62
+ version: '12.3'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '0.40'
69
+ version: '12.3'
70
70
  - !ruby/object:Gem::Dependency
71
- name: pry
71
+ name: rubocop
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '0.10'
76
+ version: '0.52'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0.10'
83
+ version: '0.52'
84
84
  - !ruby/object:Gem::Dependency
85
- name: excon
85
+ name: addressable
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0.49'
90
+ version: '2.5'
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0.49'
97
+ version: '2.5'
98
98
  - !ruby/object:Gem::Dependency
99
- name: addressable
99
+ name: excon
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
102
  - - "~>"
103
103
  - !ruby/object:Gem::Version
104
- version: '2.3'
104
+ version: '0.60'
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '2.3'
111
+ version: '0.60'
112
112
  description: Excon, with Addressable baked in.
113
113
  email:
114
114
  - jean@mertz.fm
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
- rubygems_version: 2.5.1
153
+ rubygems_version: 2.6.13
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Excon, with Addressable baked in.