facebooker 1.0.42 → 1.0.43

Sign up to get free protection for your applications and to get access to all the features.
data/facebooker.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{facebooker}
5
- s.version = "1.0.42"
5
+ s.version = "1.0.43"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Chad Fowler", "Patrick Ewing", "Mike Mangino", "Shane Vitarana", "Corey Innis"]
@@ -565,6 +565,7 @@ module Facebooker
565
565
  103 => Facebooker::Session::CallOutOfOrder,
566
566
  104 => Facebooker::Session::IncorrectSignature,
567
567
  120 => Facebooker::Session::InvalidAlbumId,
568
+ 200 => Facebooker::Session::PermissionError,
568
569
  250 => Facebooker::Session::ExtendedPermissionRequired,
569
570
  321 => Facebooker::Session::AlbumIsFull,
570
571
  324 => Facebooker::Session::MissingOrInvalidImageFile,
@@ -50,6 +50,7 @@ module Facebooker
50
50
  class FQLStatementNotIndexable < StandardError; end
51
51
  class FQLFunctionDoesNotExist < StandardError; end
52
52
  class FQLWrongNumberArgumentsPassedToFunction < StandardError; end
53
+ class PermissionError < StandardError; end
53
54
  class InvalidAlbumId < StandardError; end
54
55
  class AlbumIsFull < StandardError; end
55
56
  class MissingOrInvalidImageFile < StandardError; end
@@ -394,14 +395,22 @@ module Facebooker
394
395
  # Register a template bundle with Facebook.
395
396
  # returns the template id to use to send using this template
396
397
  def register_template_bundle(one_line_story_templates,short_story_templates=nil,full_story_template=nil, action_links=nil)
397
- parameters = {:one_line_story_templates => Array(one_line_story_templates).to_json}
398
-
399
- parameters[:action_links] = action_links.to_json unless action_links.blank?
400
-
401
- parameters[:short_story_templates] = Array(short_story_templates).to_json unless short_story_templates.blank?
402
-
403
- parameters[:full_story_template] = full_story_template.to_json unless full_story_template.blank?
404
-
398
+ templates = ensure_array(one_line_story_templates)
399
+ parameters = {:one_line_story_templates => templates.to_json}
400
+
401
+ unless action_links.blank?
402
+ parameters[:action_links] = action_links.to_json
403
+ end
404
+
405
+ unless short_story_templates.blank?
406
+ templates = ensure_array(short_story_templates)
407
+ parameters[:short_story_templates] = templates.to_json
408
+ end
409
+
410
+ unless full_story_template.blank?
411
+ parameters[:full_story_template] = full_story_template.to_json
412
+ end
413
+
405
414
  post("facebook.feed.registerTemplateBundle", parameters, false)
406
415
  end
407
416
 
@@ -628,6 +637,10 @@ module Facebooker
628
637
  end.sort.join
629
638
  Digest::MD5.hexdigest([raw_string, secret_for_method(params[:method])].join)
630
639
  end
640
+
641
+ def ensure_array(value)
642
+ value.is_a?(Array) ? value : [value]
643
+ end
631
644
  end
632
645
 
633
646
  class CanvasSession < Session
@@ -2,7 +2,7 @@ module Facebooker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 42
5
+ TINY = 43
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.42
4
+ version: 1.0.43
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler