api_client 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2dce33109687e5c643cd183ef8c656d56af40d4
4
- data.tar.gz: 97d0acdf47edc3ed2a03a00d3085c9b897687da3
3
+ metadata.gz: afef879f60d75b581ba06820fe2a817926984909
4
+ data.tar.gz: 3fc80dfc8684c9a7002cb5ef90f309621951c652
5
5
  SHA512:
6
- metadata.gz: db347b7180f5ec2296438e1be6ae95ee51fff531fd1d3d703948f5880af427ac07e89e682b6519b52f17d7ee9ce39e47a3e89fa50d57cf7b314c2bd05b5b64db
7
- data.tar.gz: eb9d837428478b41fefba7725c30bfd4093fcfe98daae2a3f19bd89673429989051dab0e6acc14276acde7bbec87823dea53663223bcfb13535ac316c87b56c0
6
+ metadata.gz: 572c68cf1e8c7da1d39afc7c15bce81b72a17f0f9046140492e327aa673f68bee195072d0a335dd3822981bb37dcc7ced9adc8e43fb9de04eb0c6b7b5a2ec3bf
7
+ data.tar.gz: 77c85f3c1f0c1da5644e61dd1b452caca2335a1ce5bc7093c5d03de7ffc5ca6b2a274f98e2f3c0a5232d3f737d1370bad3b166472dd95e00189f2b40211fc1b5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.5.7
2
+
3
+ * fix compatibility with hashie 2.1.0 and strict_attr_reader
4
+
1
5
  # 0.5.6
2
6
 
3
7
  * add strict_attr_reader option to raise `KeyError` on missing key access
@@ -58,15 +58,17 @@ module ApiClient
58
58
 
59
59
  private
60
60
  def method_missing(method_name, *args, &blk)
61
- if respond_to?(method_name)
61
+ if respond_to?(method_name) || has_special_ending?(method_name)
62
62
  super
63
+ elsif respond_to?(:strict_attr_reader?) && self.strict_attr_reader?
64
+ fetch(method_name)
63
65
  else
64
- if respond_to?(:strict_attr_reader?) && self.strict_attr_reader?
65
- fetch(method_name)
66
- else
67
- super
68
- end
66
+ super
69
67
  end
70
68
  end
69
+
70
+ def has_special_ending?(name)
71
+ name.to_s =~ /[?=]$/
72
+ end
71
73
  end
72
74
  end
@@ -1,3 +1,3 @@
1
1
  module ApiClient
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -60,10 +60,16 @@ describe ApiClient::Base do
60
60
 
61
61
  it "doesn't fail if the key was set after object was created" do
62
62
  api = StrictApi.new
63
- api.not_missing = 1
63
+ lambda { api.not_missing = 1 }.should_not raise_error
64
64
  api.not_missing.should == 1
65
65
  end
66
66
 
67
+ it "doesn't fail for predicate methods if key is not set" do
68
+ api = StrictApi.new
69
+ lambda { api.missing? }.should_not raise_error
70
+ api.missing?.should be_false
71
+ end
72
+
67
73
  it "allows to call methods" do
68
74
  api = StrictApi.new(:x => 14)
69
75
  api.accessor_of_x.should == 14
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Bunsch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yajl-ruby