mini_fb 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mini_fb.rb +21 -3
- metadata +2 -2
data/lib/mini_fb.rb
CHANGED
@@ -7,6 +7,15 @@ module MiniFB
|
|
7
7
|
FB_URL = "http://api.facebook.com/restserver.php"
|
8
8
|
FB_API_VERSION = "1.0"
|
9
9
|
|
10
|
+
@@logging = false
|
11
|
+
|
12
|
+
def enable_logging
|
13
|
+
@@logging = true
|
14
|
+
end
|
15
|
+
def disable_logging
|
16
|
+
@@logging = false
|
17
|
+
end
|
18
|
+
|
10
19
|
class FaceBookError < StandardError
|
11
20
|
# Error that happens during a facebook call.
|
12
21
|
def initialize( error_code, error_msg )
|
@@ -37,6 +46,11 @@ module MiniFB
|
|
37
46
|
end
|
38
47
|
|
39
48
|
|
49
|
+
def call(method, params={})
|
50
|
+
return MiniFB.call(api_key, secret_key, method, params.update("session_key"=>session_key))
|
51
|
+
end
|
52
|
+
|
53
|
+
|
40
54
|
end
|
41
55
|
class User
|
42
56
|
FIELDS = [:uid, :status, :political, :pic_small, :name, :quotes, :is_app_user, :tv, :profile_update_time, :meeting_sex, :hs_info, :timezone, :relationship_status, :hometown_location, :about_me, :wall_count, :significant_other_id, :pic_big, :music, :work_history, :sex, :religion, :notes_count, :activities, :pic_square, :movies, :has_added_app, :education_history, :birthday, :birthday_date, :first_name, :meeting_for, :last_name, :interests, :current_location, :pic, :books, :affiliations, :locale, :profile_url, :proxied_email, :email_hashes, :allowed_restrictions, :pic_with_logo, :pic_big_with_logo, :pic_small_with_logo, :pic_square_with_logo]
|
@@ -46,6 +60,10 @@ module MiniFB
|
|
46
60
|
FIELDS.join(",")
|
47
61
|
end
|
48
62
|
|
63
|
+
def self.standard_fields
|
64
|
+
STANDARD_FIELDS.join(",")
|
65
|
+
end
|
66
|
+
|
49
67
|
def initialize(fb_hash, session)
|
50
68
|
@fb_hash = fb_hash
|
51
69
|
@session = session
|
@@ -87,7 +105,7 @@ module MiniFB
|
|
87
105
|
pids = pids.join(",")
|
88
106
|
params["pids"] = pids
|
89
107
|
end
|
90
|
-
|
108
|
+
@session.call("photos.get", params)
|
91
109
|
end
|
92
110
|
end
|
93
111
|
|
@@ -142,7 +160,7 @@ module MiniFB
|
|
142
160
|
return response.body if custom_format
|
143
161
|
|
144
162
|
data = JSON.parse( response.body )
|
145
|
-
puts 'response=' + data.inspect
|
163
|
+
puts 'response=' + data.inspect if @@logging
|
146
164
|
if data.include?( "error_msg" ) then
|
147
165
|
raise FaceBookError.new( data["error_code"] || 1, data["error_msg"] )
|
148
166
|
end
|
@@ -161,7 +179,7 @@ module MiniFB
|
|
161
179
|
# The arguments must be a mapping of to string keys and values
|
162
180
|
# or a string of http request data.
|
163
181
|
#
|
164
|
-
# If the data is invalid or not signed properly,
|
182
|
+
# If the data is invalid or not signed properly, an empty
|
165
183
|
# dictionary is returned.
|
166
184
|
#
|
167
185
|
# The secret argument should be an instance of FacebookSecret
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_fb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|