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.
- data/lib/facebooker/models/user.rb +10 -0
- data/lib/facebooker/parser.rb +8 -1
- data/lib/facebooker/rails/helpers/fb_connect.rb +1 -1
- data/lib/facebooker/session.rb +49 -48
- data/lib/facebooker/version.rb +1 -1
- data/test/facebooker/data_test.rb +2 -2
- data/test/facebooker/models/user_test.rb +13 -0
- metadata +2 -2
@@ -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)
|
data/lib/facebooker/parser.rb
CHANGED
@@ -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('
|
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 "
|
51
|
+
else "Event.observe(window,'load',"
|
52
52
|
end} function() {
|
53
53
|
FB_RequireFeatures(#{required_features.to_json}, function() {
|
54
54
|
#{init_string}
|
data/lib/facebooker/session.rb
CHANGED
@@ -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
|
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 <
|
17
|
-
|
18
|
-
class UnknownError <
|
19
|
-
class ServiceUnavailable <
|
20
|
-
class MaxRequestsDepleted <
|
21
|
-
class HostNotAllowed <
|
22
|
-
class MissingOrInvalidParameter <
|
23
|
-
class InvalidAPIKey <
|
24
|
-
class SessionExpired <
|
25
|
-
class CallOutOfOrder <
|
26
|
-
class IncorrectSignature <
|
27
|
-
class SignatureTooOld <
|
28
|
-
class TooManyUserCalls <
|
29
|
-
class TooManyUserActionCalls <
|
30
|
-
class InvalidFeedTitleLink <
|
31
|
-
class InvalidFeedTitleLength <
|
32
|
-
class InvalidFeedTitleName <
|
33
|
-
class BlankFeedTitle <
|
34
|
-
class FeedBodyLengthTooLong <
|
35
|
-
class InvalidFeedPhotoSource <
|
36
|
-
class InvalidFeedPhotoLink <
|
37
|
-
class TemplateDataMissingRequiredTokens <
|
38
|
-
class FeedMarkupInvalid <
|
39
|
-
class FeedTitleDataInvalid <
|
40
|
-
class FeedTitleTemplateInvalid <
|
41
|
-
class FeedBodyDataInvalid <
|
42
|
-
class FeedBodyTemplateInvalid <
|
43
|
-
class FeedPhotosNotRetrieved <
|
44
|
-
class FeedTargetIdsInvalid <
|
45
|
-
class TemplateBundleInvalid <
|
46
|
-
class ConfigurationMissing <
|
47
|
-
class FQLParseError <
|
48
|
-
class FQLFieldDoesNotExist <
|
49
|
-
class FQLTableDoesNotExist <
|
50
|
-
class FQLStatementNotIndexable <
|
51
|
-
class FQLFunctionDoesNotExist <
|
52
|
-
class FQLWrongNumberArgumentsPassedToFunction <
|
53
|
-
class PermissionError <
|
54
|
-
class InvalidAlbumId <
|
55
|
-
class AlbumIsFull <
|
56
|
-
class MissingOrInvalidImageFile <
|
57
|
-
class TooManyUnapprovedPhotosPending <
|
58
|
-
class ExtendedPermissionRequired <
|
59
|
-
class ReadMailboxExtendedPermissionRequired <
|
60
|
-
class InvalidFriendList <
|
61
|
-
class UserUnRegistrationFailed <
|
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 <
|
65
|
+
class UserRegistrationFailed < Error
|
65
66
|
attr_accessor :failed_users
|
66
67
|
end
|
67
68
|
|
data/lib/facebooker/version.rb
CHANGED
@@ -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
|
-
<
|
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
|
-
</
|
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.
|
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-
|
17
|
+
date: 2010-04-23 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|