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 CHANGED
@@ -1 +1 @@
1
- 0.1.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.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-11}
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 = [
@@ -1,6 +1,3 @@
1
- module Connections
2
- end
3
-
4
1
  Dir[File.dirname(__FILE__) + '/connections/*.rb'].each do |file|
5
2
  require file
6
3
  end
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
- @start_date = Date.new(*attributes[:start_date].split('-').collect(&:to_i))
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
- @end_date = Date.new(*attributes[:end_date].split('-').collect(&:to_i))
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
@@ -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 end date' do
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 => "2008-10",
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
- - 1
9
- version: 0.1.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-11 00:00:00 +09:00
17
+ date: 2010-05-20 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency