fb_graph 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/fb_graph.gemspec +2 -2
- data/lib/fb_graph/connections.rb +0 -3
- data/lib/fb_graph/work.rb +13 -3
- data/spec/fb_graph/work_spec.rb +17 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/fb_graph.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fb_graph}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["nov matake"]
|
12
|
-
s.date = %q{2010-05-
|
12
|
+
s.date = %q{2010-05-20}
|
13
13
|
s.description = %q{A Ruby wrapper for Facebook Graph API}
|
14
14
|
s.email = %q{nov@matake.jp}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/fb_graph/connections.rb
CHANGED
data/lib/fb_graph/work.rb
CHANGED
@@ -14,11 +14,21 @@ module FbGraph
|
|
14
14
|
if (position = attributes[:position])
|
15
15
|
@position = FbGraph::Page.new(position.delete(:id), position)
|
16
16
|
end
|
17
|
-
if attributes[:start_date]
|
18
|
-
|
17
|
+
if attributes[:start_date] && attributes[:start_date] != '0000-00'
|
18
|
+
year, month = attributes[:start_date].split('-').collect(&:to_i)
|
19
|
+
@start_date = if month == 0
|
20
|
+
Date.new(year)
|
21
|
+
else
|
22
|
+
Date.new(year, month)
|
23
|
+
end
|
19
24
|
end
|
20
25
|
if attributes[:end_date] && attributes[:end_date] != '0000-00'
|
21
|
-
|
26
|
+
year, month = attributes[:end_date].split('-').collect(&:to_i)
|
27
|
+
@end_date = if month == 0
|
28
|
+
Date.new(year)
|
29
|
+
else
|
30
|
+
Date.new(year, month)
|
31
|
+
end
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
data/spec/fb_graph/work_spec.rb
CHANGED
@@ -36,17 +36,32 @@ describe FbGraph::Work, '.new' do
|
|
36
36
|
work.end_date.should == Date.new(2008, 9)
|
37
37
|
end
|
38
38
|
|
39
|
-
it 'should ignore 0000-00
|
39
|
+
it 'should ignore 0000-00 style date' do
|
40
40
|
attributes = {
|
41
41
|
:employer => {
|
42
42
|
:id => 105612642807396,
|
43
43
|
:name => "Cerego Japan Inc."
|
44
44
|
},
|
45
|
-
:start_date => "
|
45
|
+
:start_date => "0000-00",
|
46
46
|
:end_date => "0000-00"
|
47
47
|
}
|
48
48
|
work = FbGraph::Work.new(attributes)
|
49
|
+
work.start_date.should be_nil
|
49
50
|
work.end_date.should be_nil
|
50
51
|
end
|
51
52
|
|
53
|
+
it 'should treat 2010-00 date ' do
|
54
|
+
attributes = {
|
55
|
+
:employer => {
|
56
|
+
:id => 105612642807396,
|
57
|
+
:name => "Cerego Japan Inc."
|
58
|
+
},
|
59
|
+
:start_date => "2008-00",
|
60
|
+
:end_date => "2010-00"
|
61
|
+
}
|
62
|
+
work = FbGraph::Work.new(attributes)
|
63
|
+
work.start_date.should == Date.new(2008, 1)
|
64
|
+
work.end_date.should == Date.new(2010, 1)
|
65
|
+
end
|
66
|
+
|
52
67
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- nov matake
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-20 00:00:00 +09:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|