api_resource 0.6.12 → 0.6.13

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api_resource (0.6.11)
4
+ api_resource (0.6.13)
5
5
  colorize
6
6
  differ
7
7
  json
@@ -5,9 +5,10 @@ module ApiResource
5
5
  module IntegerTypecaster
6
6
 
7
7
  def self.from_api(value)
8
+ return 0 if value == false
9
+ return 1 if value == true
10
+ return nil if value.is_a?(String) && value.blank?
8
11
  return value.to_i if value.respond_to?(:to_i)
9
- # Special case so that true typecasts to 1
10
- return 1 if value.class == TrueClass
11
12
  return value.to_s.to_i
12
13
  end
13
14
 
@@ -1,3 +1,3 @@
1
1
  module ApiResource
2
- VERSION = "0.6.12"
2
+ VERSION = "0.6.13"
3
3
  end
@@ -23,7 +23,7 @@ describe ApiResource::Typecast::IntegerTypecaster do
23
23
 
24
24
  it "should be able to typecast any value you can think of" do
25
25
  klass.from_api(nil).should eql(0)
26
- klass.from_api("").should eql(0)
26
+ klass.from_api("").should eql(nil)
27
27
  klass.from_api(BasicObject).should eql(0)
28
28
  klass.from_api("abc").should eql(0)
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.13
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-09-23 00:00:00.000000000 Z
14
+ date: 2013-09-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake