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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/garage_client/request.rb +2 -0
- data/lib/garage_client/resource.rb +3 -3
- data/lib/garage_client/response.rb +3 -7
- data/lib/garage_client/version.rb +1 -1
- data/spec/garage_client/response_spec.rb +18 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a245994587e4e1f2b358c5203e422a7c9423e298
|
4
|
+
data.tar.gz: 6d1d413d48b1481b28655f27f98891f133fd037a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60b1b286474cd550eff135c2e0320c3821b2267e21750108c0bac0fb3a615e05e3fd4fe45a0f8a585af46fc10cbec5018c405570cbec67f8b6f9b6204d751f52
|
7
|
+
data.tar.gz: 53e11cf72c8418d7224eb68b1b28be5364cb80071d30b9d9241cf52ce6d6cac3dd150bc52b4ebc8e845f893d3803db6adb7a9797e31838ed17068d4387203c8e
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
51
|
+
raise NoMethodError.new("undefined method `#{name}' for #{data}")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
56
|
-
|
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
|
102
|
-
|
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
|
-
|
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?
|
@@ -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
|
+
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:
|
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.
|
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:
|