garage_client 2.1.4 → 2.1.5

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: 16fe78a58f602d1fc4dd2700c3bc2c86022a5c20
4
- data.tar.gz: 2ba4fa8caabfa063e775d7c580945822c4b9fce2
3
+ metadata.gz: a245994587e4e1f2b358c5203e422a7c9423e298
4
+ data.tar.gz: 6d1d413d48b1481b28655f27f98891f133fd037a
5
5
  SHA512:
6
- metadata.gz: 32413c94e190c89d6871ce4603abb126869c4d525cf9d749feaa3cffc67ace60ba6eb496045e9276c8728951159482ffc2206cfbeb89d4d410b2bec74567bbc1
7
- data.tar.gz: f57084f1ab1eed5a86cc1d81700509c509be924c6ab247ec8e159421ad222176b1c30163621036a0b6d69e7a2c4fead05d96abc7325469ba2d3b65cbba79b041
6
+ metadata.gz: 60b1b286474cd550eff135c2e0320c3821b2267e21750108c0bac0fb3a615e05e3fd4fe45a0f8a585af46fc10cbec5018c405570cbec67f8b6f9b6204d751f52
7
+ data.tar.gz: 53e11cf72c8418d7224eb68b1b28be5364cb80071d30b9d9241cf52ce6d6cac3dd150bc52b4ebc8e845f893d3803db6adb7a9797e31838ed17068d4387203c8e
@@ -1,3 +1,10 @@
1
+ ## 2.1.5
2
+ - Better error message for unexpected property access
3
+ - Add `:timeout` and `:open_timeout` option
4
+
5
+ ## 2.1.4
6
+ - Remove mime-types dependency
7
+
1
8
  ## 2.1.3
2
9
  - Raise GrageClient::BadRequest on 400 response as same as other http errors.
3
10
 
@@ -24,6 +24,8 @@ module GarageClient
24
24
  request.url(path, params)
25
25
  request.body = body if body
26
26
  request.headers.update(options[:headers]) if options[:headers]
27
+ request.options.timeout = options[:timeout] if options[:timeout]
28
+ request.options.open_timeout = options[:open_timeout] if options[:open_timeout]
27
29
  end
28
30
  options[:raw] ? response : GarageClient::Response.new(self, response)
29
31
  end
@@ -48,12 +48,12 @@ module GarageClient
48
48
  path = data._links[name.to_s.sub(/create_/, '')].href
49
49
  client.post(path, *args)
50
50
  else
51
- super
51
+ raise NoMethodError.new("undefined method `#{name}' for #{data}")
52
52
  end
53
53
  end
54
54
 
55
- def respond_to?(name)
56
- super || !!(properties.include?(name) || links.include?(name) || nested_resource_creation_method?(name))
55
+ def respond_to_missing?(name, include_private)
56
+ !!(properties.include?(name) || links.include?(name) || nested_resource_creation_method?(name))
57
57
  end
58
58
 
59
59
  def nested_resource_creation_method?(name)
@@ -98,18 +98,14 @@ module GarageClient
98
98
  parsed_link_header.try(:find_link, %w[rel last])
99
99
  end
100
100
 
101
- def respond_to?(name, *args)
102
- super || body.respond_to?(name, *args)
101
+ def respond_to_missing?(name, include_private)
102
+ body.respond_to?(name, include_private)
103
103
  end
104
104
 
105
105
  private
106
106
 
107
107
  def method_missing(name, *args, &block)
108
- if body.respond_to?(name)
109
- body.send(name, *args, &block)
110
- else
111
- super
112
- end
108
+ body.send(name, *args, &block)
113
109
  end
114
110
 
115
111
  def dictionary_response?
@@ -1,3 +1,3 @@
1
1
  module GarageClient
2
- VERSION = '2.1.4'
2
+ VERSION = '2.1.5'
3
3
  end
@@ -72,6 +72,24 @@ describe GarageClient::Response do
72
72
  end
73
73
  end
74
74
 
75
+ describe "#method" do
76
+ context "with same property" do
77
+ before do
78
+ body["name"] = "example"
79
+ end
80
+
81
+ it "returns method object" do
82
+ response.method(:name).should be_kind_of(Method)
83
+ end
84
+ end
85
+
86
+ context "with neithor same property nor same method" do
87
+ it "raises an error" do
88
+ expect { response.method(:name) }.to raise_error(NameError)
89
+ end
90
+ end
91
+ end
92
+
75
93
  describe "#has_next_page?" do
76
94
  context "without Link header" do
77
95
  before do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garage_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cookpad Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  version: '0'
244
244
  requirements: []
245
245
  rubyforge_project:
246
- rubygems_version: 2.4.5
246
+ rubygems_version: 2.5.1
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Ruby client library for the Garage API
@@ -264,4 +264,3 @@ test_files:
264
264
  - spec/garage_client/response_spec.rb
265
265
  - spec/garage_client_spec.rb
266
266
  - spec/spec_helper.rb
267
- has_rdoc: