jeff 1.1.0 → 1.2.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: 2acf8a725f47146cc30fbae49e80c7b264596681
4
- data.tar.gz: 76ae8492c0281afdbd8b5b48c213a65abe774b22
3
+ metadata.gz: 3867d229eb05451a032899de8e28246d02498e6d
4
+ data.tar.gz: 3d03ba5a26edb20d7528c323e2526ff11293e0cd
5
5
  SHA512:
6
- metadata.gz: 664387a93beb1ba57352c12fd1937952a7f6ddca07118a3ab7bc114737b69f59108c7e2603fa31a1b38cfe5573a931eb113f17c7719f25aa9d0d14cf2e325b98
7
- data.tar.gz: 0644c4f20f9a14ef53ca6c618534569c8e88277d177c136460dbfa3352b104122d53c475c2cc9e73b4f8fe6ddb7f7b7dd5923a2da844530bf644df1a058586e5
6
+ metadata.gz: e513eb4d6bbbf3653362fcaf1d5afc458ee7281509711a95d8d379af208b21686a6dc3aed1e62cfb81e3562a32d59f24dc7ed1b251d37427d4ae2390f12c785e
7
+ data.tar.gz: 7b3f7c9ad65ecea40f25d666099929e85e5c2476c3cd078412e9df44c1335f75915af0a845d8b31e9a054d9a7fd49cb2211581094aaee9638df9f2051e4c360e
data/CHANGELOG.md CHANGED
@@ -1,7 +1,15 @@
1
+ # 1.2.0 23/1/2015
2
+
3
+ - Discard parameters with nil values
4
+
5
+ # 1.1.0 15/10/2014
6
+
7
+ - Allow customising user agent
8
+
1
9
  # 1.0.1 18/12/2013
2
10
 
3
- relax Excon dependency version
11
+ - Relax Excon dependency version
4
12
 
5
13
  # 1.0.0 25/11/2013
6
14
 
7
- first stable release
15
+ - First stable release
data/jeff.gemspec CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |gem|
8
8
  gem.description = %q{An Amazon Web Services client}
9
9
  gem.summary = %q{An AWS client}
10
10
  gem.homepage = "https://github.com/hakanensari/jeff"
11
+ gem.license = "MIT"
11
12
 
12
13
  gem.files = `git ls-files`.split($\)
13
14
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
data/lib/jeff/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jeff
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/jeff.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Jeff"s only external dependency.
1
+ # Jeff's only external dependency.
2
2
  require "excon"
3
3
 
4
4
  # Standard library dependencies.
@@ -74,7 +74,7 @@ module Jeff
74
74
  end
75
75
  end
76
76
 
77
- # Because Ruby"s CGI escapes tilde, use a custom escape.
77
+ # Because Ruby's CGI escapes tilde, use a custom escape.
78
78
  module Utils
79
79
  UNRESERVED = /([^\w.~-]+)/
80
80
 
@@ -154,9 +154,13 @@ module Jeff
154
154
  end
155
155
 
156
156
  def default_query_values
157
- self.class.params.reduce({}) { |a, (k, v)|
158
- a.update(k => (v.respond_to?(:call) ? instance_exec(&v) : v))
159
- }
157
+ self.class.params
158
+ .reduce({}) { |qv, (k, v)|
159
+ v = v.respond_to?(:call) ? instance_exec(&v) : v
160
+
161
+ # Ignore keys with nil values
162
+ v.nil? ? qv : qv.update(k => v)
163
+ }
160
164
  end
161
165
 
162
166
  module ClassMethods
data/test/test_jeff.rb CHANGED
@@ -25,12 +25,25 @@ class TestJeff < Minitest::Test
25
25
  end
26
26
 
27
27
  def test_configures_request_query_parameters
28
- @klass.instance_eval do
29
- params "Foo" => "bar"
30
- end
28
+ @klass.params "Foo" => "bar"
31
29
  assert @klass.params.has_key?("Foo")
32
30
  end
33
31
 
32
+ def test_allows_dynamic_values_for_request_query_parameters
33
+ @klass.params "Foo" => -> { bar }
34
+ client = @klass.new
35
+ def client.bar; "baz"; end
36
+ assert client.bar, client.send(:default_query_values).fetch("Foo")
37
+ assert_kind_of Proc, @klass.params["Foo"]
38
+ end
39
+
40
+ def test_discards_request_query_parameters_with_nil_values
41
+ @klass.params "Foo" => -> { bar }
42
+ client = @klass.new
43
+ def client.bar; end
44
+ refute client.send(:default_query_values).key?("Foo")
45
+ end
46
+
34
47
  def test_requires_signature
35
48
  signature = Jeff::Signature.new(nil)
36
49
  assert_raises(ArgumentError) { signature.sign("foo") }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hakan Ensari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -71,7 +71,8 @@ files:
71
71
  - lib/jeff/version.rb
72
72
  - test/test_jeff.rb
73
73
  homepage: https://github.com/hakanensari/jeff
74
- licenses: []
74
+ licenses:
75
+ - MIT
75
76
  metadata: {}
76
77
  post_install_message:
77
78
  rdoc_options: []
@@ -89,9 +90,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  version: '0'
90
91
  requirements: []
91
92
  rubyforge_project:
92
- rubygems_version: 2.2.2
93
+ rubygems_version: 2.4.5
93
94
  signing_key:
94
95
  specification_version: 4
95
96
  summary: An AWS client
96
97
  test_files:
97
98
  - test/test_jeff.rb
99
+ has_rdoc: