fb_graph 1.6.8 → 1.6.9

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.8
1
+ 1.6.9
data/fb_graph.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.6.8"
8
+ s.version = "1.6.9"
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"]
data/lib/fb_graph/node.rb CHANGED
@@ -116,15 +116,11 @@ module FbGraph
116
116
 
117
117
  def handle_restclient_error(e)
118
118
  _response_ = JSON.parse(e.http_body).with_indifferent_access
119
- if _response_[:error]
120
- case _response_[:error][:type]
121
- when /OAuth/
122
- raise Unauthorized.new(_response_[:error][:message])
123
- else
124
- raise BadRequest.new("#{_response_[:error][:type]} :: #{_response_[:error][:message]}")
125
- end
119
+ case _response_[:error][:type]
120
+ when /OAuth/
121
+ raise Unauthorized.new(e.message, e.http_body)
126
122
  else
127
- raise Exception.new(e.http_code, e.message, e.http_body)
123
+ raise BadRequest.new(e.message, e.http_body)
128
124
  end
129
125
  rescue JSON::ParserError
130
126
  raise Exception.new(e.http_code, e.message, e.http_body)
@@ -1,9 +1,8 @@
1
1
  require File.join(File.dirname(__FILE__), '../spec_helper')
2
2
 
3
- describe FbGraph::Event, '.new' do
4
-
5
- it 'should setup all supported attributes' do
6
- attributes = {
3
+ describe FbGraph::Event do
4
+ let :attributes do
5
+ {
7
6
  :id => '12345',
8
7
  :owner => {
9
8
  :id => '23456',
@@ -26,25 +25,37 @@ describe FbGraph::Event, '.new' do
26
25
  :privacy => 'OPEN',
27
26
  :updated_time => '2010-01-02T15:37:41+0000'
28
27
  }
29
- event = FbGraph::Event.new(attributes.delete(:id), attributes)
30
- event.identifier.should == '12345'
31
- event.owner.should == FbGraph::User.new('23456', :name => 'nov matake')
32
- event.name.should == 'event 1'
33
- event.description.should == 'an event for fb_graph test'
34
- event.start_time.should == Time.parse('2010-03-14T21:00:00+0000')
35
- event.end_time.should == Time.parse('2010-03-15T00:30:00+0000')
36
- event.location.should == 'Smart.fm office'
37
- event.venue.should == FbGraph::Venue.new(
38
- :street => 'Sakuragaoka',
39
- :city => 'Shibuya',
40
- :state => 'Tokyo',
41
- :zip => '150-0031',
42
- :country => 'Japan',
43
- :latitude => '35.685',
44
- :longitude => '139.751'
45
- )
46
- event.privacy.should == 'OPEN'
47
- event.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
48
28
  end
29
+ let(:event) { FbGraph::Event.new(attributes.delete(:id), attributes) }
49
30
 
31
+ describe '.new' do
32
+ it 'should setup all supported attributes' do
33
+ event.identifier.should == '12345'
34
+ event.owner.should == FbGraph::User.new('23456', :name => 'nov matake')
35
+ event.name.should == 'event 1'
36
+ event.description.should == 'an event for fb_graph test'
37
+ event.start_time.should == Time.parse('2010-03-14T21:00:00+0000')
38
+ event.end_time.should == Time.parse('2010-03-15T00:30:00+0000')
39
+ event.location.should == 'Smart.fm office'
40
+ event.venue.should == FbGraph::Venue.new(
41
+ :street => 'Sakuragaoka',
42
+ :city => 'Shibuya',
43
+ :state => 'Tokyo',
44
+ :zip => '150-0031',
45
+ :country => 'Japan',
46
+ :latitude => '35.685',
47
+ :longitude => '139.751'
48
+ )
49
+ event.privacy.should == 'OPEN'
50
+ event.updated_time.should == Time.parse('2010-01-02T15:37:41+0000')
51
+ end
52
+ end
53
+
54
+ describe '#update' do
55
+ it 'should update existing event' do
56
+ lambda do
57
+ event.update(:location => 'Kyoto', :access_token => 'access_token')
58
+ end.should request_to('12345', :post)
59
+ end
60
+ end
50
61
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
- - 8
10
- version: 1.6.8
9
+ - 9
10
+ version: 1.6.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake