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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2a623a933bc13f4e6f553104fc28d763da78645e
4
- data.tar.gz: cf8145338c54db7abc2edd21afbe9e58fc38e8a0
2
+ SHA256:
3
+ metadata.gz: 8c28d0f7144700d3eb5347249df282095c2b716c1e45fb7f6fb25c7cb3c3c668
4
+ data.tar.gz: 9e2dd1472a2d4998cd584bdb8223373c1693346c3227af5b2ccd9f2511e6d730
5
5
  SHA512:
6
- metadata.gz: c02237c7096e98477fda1b478ee0fa7c49350d0759cb21af75a122398e5328560f16d70cc5b454885d70cf684e1e7ec18999cebdfbe5fa4b2f1e5f306f8bd778
7
- data.tar.gz: 7f18c93b54d51a151c51e5a3f492a421f97b35768502b5ee6d5fdf0567e565b83c806bf5254d6d8ed3bf773a4a2dbd0a6f9073684486719ef706b4f85c9462f7
6
+ metadata.gz: 99e68b0cb1c67c5c2ce2079a70ab6d070c4dbce710b009833fd85c7d5390b1e9e521576e98d834c97c87110a6c8f1f75d68a719b9239aa8e36dbdff5a2198d9f
7
+ data.tar.gz: ec8102b0b9c423e33aea965dcf01b817d8cfb9d541f35e74d2b8e6a1f3bd6674ca851aa01acb545b8ce481073f055b0d37c7ed8283ad6149b59efa56ad0fa813
@@ -2,8 +2,10 @@ language: ruby
2
2
 
3
3
  rvm:
4
4
  - ruby-head
5
- - 2.3.1
6
- - 2.2.5
5
+ - 2.5.3
6
+ - 2.4.5
7
+ - 2.3.8
8
+ - 2.2.10
7
9
  matrix:
8
10
  allow_failures:
9
11
  - rvm: "ruby-head"
@@ -1,3 +1,7 @@
1
+ ## 2.4.3
2
+ - Support query methods on GarageClient::Resource
3
+ - Use Module#module_parent_name for Rails 6.0
4
+
1
5
  ## 2.4.2
2
6
  - Fixes for latest aws-xray gem. Require `aws/xray/faraday`.
3
7
 
@@ -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
- c.name = ::Rails.application.class.parent_name.underscore
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
@@ -1,3 +1,3 @@
1
1
  module GarageClient
2
- VERSION = '2.4.2'
2
+ VERSION = '2.4.3'
3
3
  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.2
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: 2017-06-26 00:00:00.000000000 Z
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
- rubyforge_project:
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