facebooker 1.0.67 → 1.0.68

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.
@@ -207,6 +207,16 @@ module Facebooker
207
207
  @session.post('facebook.stream.addLike', {:post_id=>post_id})
208
208
  end
209
209
 
210
+ ###
211
+ # Remove a like on a post
212
+ #
213
+ # See: http://wiki.developers.facebook.com/index.php/Stream.removeLike
214
+ #
215
+ # +post_id+ the post_id for the post that is being commented on
216
+ def remove_like_on(post_id)
217
+ @session.post('facebook.stream.removeLike', {:post_id=>post_id})
218
+ end
219
+
210
220
  def friend_lists
211
221
  @friend_lists ||= @session.post('facebook.friends.getLists').map do |hash|
212
222
  friend_list = FriendList.from_hash(hash)
@@ -284,6 +284,12 @@ module Facebooker
284
284
  end
285
285
  end
286
286
 
287
+ class StreamRemoveLike < Parser#:nodoc:
288
+ def self.process(data)
289
+ booleanize(element('stream_removeLike_response', data).content.strip)
290
+ end
291
+ end
292
+
287
293
  class RegisterTemplateBundle < Parser#:nodoc:
288
294
  def self.process(data)
289
295
  element('feed_registerTemplateBundle_response', data).content.to_i
@@ -569,7 +575,7 @@ module Facebooker
569
575
 
570
576
  class GetCookies < Parser#:nodoc:
571
577
  def self.process(data)
572
- array_of_hashes(element('data_getCookie_response', data), 'cookies')
578
+ array_of_hashes(element('data_getCookies_response', data), 'cookies')
573
579
  end
574
580
  end
575
581
 
@@ -928,6 +934,7 @@ module Facebooker
928
934
  'facebook.stream.publish' => StreamPublish,
929
935
  'facebook.stream.addComment' => StreamAddComment,
930
936
  'facebook.stream.addLike' => StreamAddLike,
937
+ 'facebook.stream.removeLike' => StreamRemoveLike,
931
938
  'facebook.events.create' => EventsCreate,
932
939
  'facebook.events.cancel' => EventsCancel,
933
940
  'facebook.events.get' => EventsGet,
@@ -48,7 +48,7 @@ module Facebooker
48
48
  when :jquery then "jQuery(document).ready("
49
49
  when :dojo then "dojo.addOnLoad("
50
50
  when :mootools then "window.addEvent('domready',"
51
- else "Element.observe(window,'load',"
51
+ else "Event.observe(window,'load',"
52
52
  end} function() {
53
53
  FB_RequireFeatures(#{required_features.to_json}, function() {
54
54
  #{init_string}
@@ -4,7 +4,8 @@ module Facebooker
4
4
  #
5
5
  # Raised when trying to perform an operation on a user
6
6
  # other than the logged in user (if that's unallowed)
7
- class NonSessionUser < StandardError; end
7
+ class Error < StandardError; end
8
+ class NonSessionUser < Error; end
8
9
  class Session
9
10
 
10
11
  #
@@ -13,55 +14,55 @@ module Facebooker
13
14
  # user logs out of facebook
14
15
  # can be handled with:
15
16
  # rescue_from Facebooker::Session::SessionExpired, :with => :some_method_name
16
- class SessionExpired < StandardError; end
17
-
18
- class UnknownError < StandardError; end
19
- class ServiceUnavailable < StandardError; end
20
- class MaxRequestsDepleted < StandardError; end
21
- class HostNotAllowed < StandardError; end
22
- class MissingOrInvalidParameter < StandardError; end
23
- class InvalidAPIKey < StandardError; end
24
- class SessionExpired < StandardError; end
25
- class CallOutOfOrder < StandardError; end
26
- class IncorrectSignature < StandardError; end
27
- class SignatureTooOld < StandardError; end
28
- class TooManyUserCalls < StandardError; end
29
- class TooManyUserActionCalls < StandardError; end
30
- class InvalidFeedTitleLink < StandardError; end
31
- class InvalidFeedTitleLength < StandardError; end
32
- class InvalidFeedTitleName < StandardError; end
33
- class BlankFeedTitle < StandardError; end
34
- class FeedBodyLengthTooLong < StandardError; end
35
- class InvalidFeedPhotoSource < StandardError; end
36
- class InvalidFeedPhotoLink < StandardError; end
37
- class TemplateDataMissingRequiredTokens < StandardError; end
38
- class FeedMarkupInvalid < StandardError; end
39
- class FeedTitleDataInvalid < StandardError; end
40
- class FeedTitleTemplateInvalid < StandardError; end
41
- class FeedBodyDataInvalid < StandardError; end
42
- class FeedBodyTemplateInvalid < StandardError; end
43
- class FeedPhotosNotRetrieved < StandardError; end
44
- class FeedTargetIdsInvalid < StandardError; end
45
- class TemplateBundleInvalid < StandardError; end
46
- class ConfigurationMissing < StandardError; end
47
- class FQLParseError < StandardError; end
48
- class FQLFieldDoesNotExist < StandardError; end
49
- class FQLTableDoesNotExist < StandardError; end
50
- class FQLStatementNotIndexable < StandardError; end
51
- class FQLFunctionDoesNotExist < StandardError; end
52
- class FQLWrongNumberArgumentsPassedToFunction < StandardError; end
53
- class PermissionError < StandardError; end
54
- class InvalidAlbumId < StandardError; end
55
- class AlbumIsFull < StandardError; end
56
- class MissingOrInvalidImageFile < StandardError; end
57
- class TooManyUnapprovedPhotosPending < StandardError; end
58
- class ExtendedPermissionRequired < StandardError; end
59
- class ReadMailboxExtendedPermissionRequired < StandardError; end
60
- class InvalidFriendList < StandardError; end
61
- class UserUnRegistrationFailed < StandardError
17
+ class SessionExpired < Error; end
18
+
19
+ class UnknownError < Error; end
20
+ class ServiceUnavailable < Error; end
21
+ class MaxRequestsDepleted < Error; end
22
+ class HostNotAllowed < Error; end
23
+ class MissingOrInvalidParameter < Error; end
24
+ class InvalidAPIKey < Error; end
25
+ class SessionExpired < Error; end
26
+ class CallOutOfOrder < Error; end
27
+ class IncorrectSignature < Error; end
28
+ class SignatureTooOld < Error; end
29
+ class TooManyUserCalls < Error; end
30
+ class TooManyUserActionCalls < Error; end
31
+ class InvalidFeedTitleLink < Error; end
32
+ class InvalidFeedTitleLength < Error; end
33
+ class InvalidFeedTitleName < Error; end
34
+ class BlankFeedTitle < Error; end
35
+ class FeedBodyLengthTooLong < Error; end
36
+ class InvalidFeedPhotoSource < Error; end
37
+ class InvalidFeedPhotoLink < Error; end
38
+ class TemplateDataMissingRequiredTokens < Error; end
39
+ class FeedMarkupInvalid < Error; end
40
+ class FeedTitleDataInvalid < Error; end
41
+ class FeedTitleTemplateInvalid < Error; end
42
+ class FeedBodyDataInvalid < Error; end
43
+ class FeedBodyTemplateInvalid < Error; end
44
+ class FeedPhotosNotRetrieved < Error; end
45
+ class FeedTargetIdsInvalid < Error; end
46
+ class TemplateBundleInvalid < Error; end
47
+ class ConfigurationMissing < Error; end
48
+ class FQLParseError < Error; end
49
+ class FQLFieldDoesNotExist < Error; end
50
+ class FQLTableDoesNotExist < Error; end
51
+ class FQLStatementNotIndexable < Error; end
52
+ class FQLFunctionDoesNotExist < Error; end
53
+ class FQLWrongNumberArgumentsPassedToFunction < Error; end
54
+ class PermissionError < Error; end
55
+ class InvalidAlbumId < Error; end
56
+ class AlbumIsFull < Error; end
57
+ class MissingOrInvalidImageFile < Error; end
58
+ class TooManyUnapprovedPhotosPending < Error; end
59
+ class ExtendedPermissionRequired < Error; end
60
+ class ReadMailboxExtendedPermissionRequired < Error; end
61
+ class InvalidFriendList < Error; end
62
+ class UserUnRegistrationFailed < Error
62
63
  attr_accessor :failed_users
63
64
  end
64
- class UserRegistrationFailed < StandardError
65
+ class UserRegistrationFailed < Error
65
66
  attr_accessor :failed_users
66
67
  end
67
68
 
@@ -2,7 +2,7 @@ module Facebooker #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 67
5
+ TINY = 68
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -53,7 +53,7 @@ class Facebooker::DataTest < Test::Unit::TestCase
53
53
  def example_get_cookies_xml
54
54
  <<-XML
55
55
  <?xml version="1.0" encoding="UTF-8"?>
56
- <data_getCookie_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
56
+ <data_getCookies_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
57
57
  xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
58
58
  <cookies>
59
59
  <uid>508508326</uid>
@@ -62,7 +62,7 @@ class Facebooker::DataTest < Test::Unit::TestCase
62
62
  <expires>0</expires>
63
63
  <path>/tmp/</path>
64
64
  </cookies>
65
- </data_getCookie_response>
65
+ </data_getCookies_response>
66
66
  XML
67
67
  end
68
68
 
@@ -224,6 +224,12 @@ class Facebooker::UserTest < Test::Unit::TestCase
224
224
  assert_equal('1', @user.add_like_on('703826862_78463536862'))
225
225
  end
226
226
 
227
+ def test_remove_like_on
228
+ @user = Facebooker::User.new(548871286, @session)
229
+ expect_http_posts_with_responses(example_remove_like_on_response)
230
+ assert_equal(true, @user.remove_like_on('703826862_78463536862'))
231
+ end
232
+
227
233
  def test_can_send_email
228
234
  @user.expects(:send_email).with("subject", "body text")
229
235
  @user.send_email("subject", "body text")
@@ -712,6 +718,13 @@ class Facebooker::UserTest < Test::Unit::TestCase
712
718
  eoxml
713
719
  end
714
720
 
721
+ def example_remove_like_on_response
722
+ <<-eoxml
723
+ <?xml version="1.0" encoding="UTF-8"?>
724
+ <stream_removeLike_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</stream_removeLike_response>
725
+ eoxml
726
+ end
727
+
715
728
  def example_events_rsvp_xml
716
729
  <<-E
717
730
  <?xml version="1.0" encoding="UTF-8"?>
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.67
4
+ version: 1.0.68
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-30 00:00:00 -04:00
17
+ date: 2010-04-23 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency