to_api 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/to_api/version.rb +1 -1
- data/lib/to_api.rb +4 -4
- data/spec/to_api_spec.rb +9 -9
- metadata +4 -4
data/lib/to_api/version.rb
CHANGED
data/lib/to_api.rb
CHANGED
@@ -19,7 +19,7 @@ if Object.const_defined? :ActiveRecord
|
|
19
19
|
|
20
20
|
to_api_attributes.each do |k, v|
|
21
21
|
attribute_includes = include_hash[k] || []
|
22
|
-
v = v.to_api(*attribute_includes)
|
22
|
+
v = v.to_api(*attribute_includes)
|
23
23
|
hash[k] = v
|
24
24
|
end
|
25
25
|
|
@@ -70,19 +70,19 @@ end
|
|
70
70
|
|
71
71
|
class DateTime
|
72
72
|
def to_api(*includes)
|
73
|
-
|
73
|
+
self
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
class Date
|
78
78
|
def to_api(*includes)
|
79
|
-
|
79
|
+
self
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
class Time
|
84
84
|
def to_api(*includes)
|
85
|
-
|
85
|
+
self
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
data/spec/to_api_spec.rb
CHANGED
@@ -76,9 +76,9 @@ describe '#to_api' do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
describe DateTime do
|
79
|
-
it "returns
|
80
|
-
now = DateTime.
|
81
|
-
now.to_api.should ==
|
79
|
+
it "returns self" do
|
80
|
+
now = DateTime.now
|
81
|
+
now.to_api.should == now
|
82
82
|
end
|
83
83
|
describe "ingoring includes" do
|
84
84
|
let(:instance) { DateTime.now }
|
@@ -87,9 +87,9 @@ describe '#to_api' do
|
|
87
87
|
end
|
88
88
|
|
89
89
|
describe Date do
|
90
|
-
it "returns
|
91
|
-
now = Date.
|
92
|
-
now.to_api.should ==
|
90
|
+
it "returns self" do
|
91
|
+
now = Date.today
|
92
|
+
now.to_api.should == now
|
93
93
|
end
|
94
94
|
describe "ignoring includes" do
|
95
95
|
let(:instance){ Date.today }
|
@@ -98,9 +98,9 @@ describe '#to_api' do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
describe Time do
|
101
|
-
it "returns
|
102
|
-
now = Time.
|
103
|
-
now.to_api.should ==
|
101
|
+
it "returns self" do
|
102
|
+
now = Time.now
|
103
|
+
now.to_api.should == now
|
104
104
|
end
|
105
105
|
describe "ingoring includes" do
|
106
106
|
let(:instance) { Time.now }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Shawn Anderson
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-01-
|
19
|
+
date: 2011-01-12 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|