sinbook 0.1.6 → 0.1.7

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.
Files changed (3) hide show
  1. data/lib/sinbook.rb +9 -3
  2. data/sinbook.gemspec +2 -2
  3. metadata +2 -2
data/lib/sinbook.rb CHANGED
@@ -5,6 +5,10 @@ rescue LoadError
5
5
  raise
6
6
  end
7
7
 
8
+ class FacebookError < StandardError
9
+ attr_accessor :data
10
+ end
11
+
8
12
  module Sinatra
9
13
  require 'digest/md5'
10
14
  require 'yajl'
@@ -222,7 +226,11 @@ module Sinatra
222
226
  Yajl::Parser.parse(ret, :symbolize_keys => @symbolize_keys)
223
227
  end
224
228
 
225
- raise Facebook::Error, ret['error_msg'] if ret.is_a? Hash and ret['error_code']
229
+ if ret.is_a?(Hash) and (ret['error_code'] or ret[:error_code])
230
+ err = FacebookError.new(ret['error_msg'] || ret[:error_msg])
231
+ err.data = ret
232
+ raise err
233
+ end
226
234
 
227
235
  ret
228
236
  end
@@ -332,8 +340,6 @@ module Sinatra
332
340
  end
333
341
 
334
342
  module Facebook
335
- class Error < StandardError; end
336
-
337
343
  def facebook &blk
338
344
  FacebookSettings.new(self, &blk)
339
345
  end
data/sinbook.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  spec = Gem::Specification.new do |s|
2
2
  s.name = 'sinbook'
3
- s.version = '0.1.6'
4
- s.date = '2009-11-26'
3
+ s.version = '0.1.7'
4
+ s.date = '2009-12-26'
5
5
  s.summary = 'simple sinatra facebook extension in 300 lines of ruby'
6
6
  s.description = 'A full-featured facebook extension for the sinatra webapp framework'
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-26 00:00:00 -05:00
12
+ date: 2009-12-26 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency