garage_client 2.4.2 → 2.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -2
- data/CHANGELOG.md +4 -0
- data/garage_client.gemspec +0 -2
- data/lib/garage_client/railtie.rb +7 -1
- data/lib/garage_client/resource.rb +12 -1
- data/lib/garage_client/version.rb +1 -1
- data/spec/garage_client/resource_spec.rb +6 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c28d0f7144700d3eb5347249df282095c2b716c1e45fb7f6fb25c7cb3c3c668
|
4
|
+
data.tar.gz: 9e2dd1472a2d4998cd584bdb8223373c1693346c3227af5b2ccd9f2511e6d730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99e68b0cb1c67c5c2ce2079a70ab6d070c4dbce710b009833fd85c7d5390b1e9e521576e98d834c97c87110a6c8f1f75d68a719b9239aa8e36dbdff5a2198d9f
|
7
|
+
data.tar.gz: ec8102b0b9c423e33aea965dcf01b817d8cfb9d541f35e74d2b8e6a1f3bd6674ca851aa01acb545b8ce481073f055b0d37c7ed8283ad6149b59efa56ad0fa813
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/garage_client.gemspec
CHANGED
@@ -22,8 +22,6 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_dependency 'hashie', '>= 1.2.0'
|
23
23
|
s.add_dependency 'link_header'
|
24
24
|
|
25
|
-
s.add_dependency 'system_timer' if RUBY_VERSION < '1.9'
|
26
|
-
|
27
25
|
s.add_development_dependency "rails"
|
28
26
|
s.add_development_dependency "rake", ">= 0.9.2"
|
29
27
|
s.add_development_dependency "rspec"
|
@@ -9,7 +9,13 @@ module GarageClient
|
|
9
9
|
def self.set_default_name
|
10
10
|
unless GarageClient.configuration.options[:name]
|
11
11
|
GarageClient.configure do |c|
|
12
|
-
|
12
|
+
klass = ::Rails.application.class
|
13
|
+
parent_name = if klass.respond_to?(:module_parent_name)
|
14
|
+
klass.module_parent_name
|
15
|
+
else
|
16
|
+
klass.parent_name
|
17
|
+
end
|
18
|
+
c.name = parent_name.underscore
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -41,6 +41,8 @@ module GarageClient
|
|
41
41
|
else
|
42
42
|
value
|
43
43
|
end
|
44
|
+
elsif query_method?(name)
|
45
|
+
data.__send__(name)
|
44
46
|
elsif links.include?(name)
|
45
47
|
path = data._links[name].href
|
46
48
|
client.get(path, *args)
|
@@ -53,11 +55,20 @@ module GarageClient
|
|
53
55
|
end
|
54
56
|
|
55
57
|
def respond_to_missing?(name, include_private)
|
56
|
-
!!(properties.include?(name) || links.include?(name) || nested_resource_creation_method?(name))
|
58
|
+
!!(properties.include?(name) || query_method?(name) || links.include?(name) || nested_resource_creation_method?(name))
|
57
59
|
end
|
58
60
|
|
59
61
|
def nested_resource_creation_method?(name)
|
60
62
|
!!(name =~ /\Acreate_(.+)\z/ && links.include?($1.to_sym))
|
61
63
|
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def query_method?(name)
|
68
|
+
if name.to_s.end_with?('?')
|
69
|
+
key = name.to_s[0..-2]
|
70
|
+
properties.include?(key.to_sym)
|
71
|
+
end
|
72
|
+
end
|
62
73
|
end
|
63
74
|
end
|
@@ -84,6 +84,12 @@ describe GarageClient::Resource do
|
|
84
84
|
resource.user.should be_kind_of(GarageClient::Resource)
|
85
85
|
end
|
86
86
|
end
|
87
|
+
|
88
|
+
context 'with property query' do
|
89
|
+
it 'returns presence' do
|
90
|
+
resource.name?.should == true
|
91
|
+
end
|
92
|
+
end
|
87
93
|
end
|
88
94
|
|
89
95
|
describe 'link' 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.4.
|
4
|
+
version: 2.4.3
|
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: 2019-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -260,8 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
- !ruby/object:Gem::Version
|
261
261
|
version: '0'
|
262
262
|
requirements: []
|
263
|
-
|
264
|
-
rubygems_version: 2.5.2
|
263
|
+
rubygems_version: 3.0.3
|
265
264
|
signing_key:
|
266
265
|
specification_version: 4
|
267
266
|
summary: Ruby client library for the Garage API
|