rplatform 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +0 -0
- data/HISTORY.txt +3 -0
- data/README.txt +41 -0
- data/Rakefile +21 -0
- data/lib/facebook_desktop_session.rb +124 -0
- data/lib/facebook_session.rb +397 -0
- data/lib/facebook_web_session.rb +124 -0
- data/lib/facepricot.rb +135 -0
- data/lib/rfacebook.rb +5 -0
- data/test/facebook_desktop_session_test.rb +54 -0
- data/test/facebook_session_test_methods.rb +106 -0
- data/test/facebook_web_session_test.rb +48 -0
- data/test/test_helper.rb +218 -0
- metadata +75 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'mocha'
|
4
|
+
require 'rfacebook'
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
module RFacebook
|
10
|
+
module Dummy
|
11
|
+
|
12
|
+
API_KEY = "dummykey123"
|
13
|
+
API_SECRET = "dummysecret456"
|
14
|
+
|
15
|
+
AUTH_CREATETOKEN_RESPONSE = <<-EOF
|
16
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
17
|
+
<auth_createToken_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">3e4a22bb2f5ed75114b0fc9995ea85f1</auth_createToken_response>
|
18
|
+
EOF
|
19
|
+
|
20
|
+
ERROR_RESPONSE = <<-EOF
|
21
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
22
|
+
<error_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">
|
23
|
+
<error_code>5</error_code>
|
24
|
+
<error_msg>Unauthorized source IP address (ip was: 10.1.2.3)</error_msg>
|
25
|
+
<request_args list="true">
|
26
|
+
<arg>
|
27
|
+
<key>method</key>
|
28
|
+
<value>facebook.friends.get</value>
|
29
|
+
</arg>
|
30
|
+
<arg>
|
31
|
+
<key>session_key</key>
|
32
|
+
<value>373443c857fcda2e410e349c-i7nF4PqX4IW4.</value>
|
33
|
+
</arg>
|
34
|
+
<arg>
|
35
|
+
<key>api_key</key>
|
36
|
+
<value>0289b21f46b2ee642d5c42145df5489f</value>
|
37
|
+
</arg>
|
38
|
+
<arg>
|
39
|
+
<key>call_id</key>
|
40
|
+
<value>1170813376.3544</value>
|
41
|
+
</arg>
|
42
|
+
<arg>
|
43
|
+
<key>v</key>
|
44
|
+
<value>1.0</value>
|
45
|
+
</arg>
|
46
|
+
<arg>
|
47
|
+
<key>sig</key>
|
48
|
+
<value>570dcc2b764578af350ea1e1622349a0</value>
|
49
|
+
</arg>
|
50
|
+
</request_args>
|
51
|
+
</error_response>
|
52
|
+
EOF
|
53
|
+
|
54
|
+
ERROR_RESPONSE_3 = <<-EOF
|
55
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
56
|
+
<error_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">
|
57
|
+
<error_code>3</error_code>
|
58
|
+
<error_msg>method does not exist</error_msg>
|
59
|
+
</error_response>
|
60
|
+
EOF
|
61
|
+
|
62
|
+
ERROR_RESPONSE_100 = <<-EOF
|
63
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
64
|
+
<error_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">
|
65
|
+
<error_code>100</error_code>
|
66
|
+
<error_msg>bad arguments</error_msg>
|
67
|
+
</error_response>
|
68
|
+
EOF
|
69
|
+
|
70
|
+
ERROR_RESPONSE_102 = <<-EOF
|
71
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
72
|
+
<error_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">
|
73
|
+
<error_code>102</error_code>
|
74
|
+
<error_msg>expired session</error_msg>
|
75
|
+
</error_response>
|
76
|
+
EOF
|
77
|
+
|
78
|
+
ERROR_RESPONSE_606 = <<-EOF
|
79
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
80
|
+
<error_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">
|
81
|
+
<error_code>606</error_code>
|
82
|
+
<error_msg>wrong number of arguments</error_msg>
|
83
|
+
</error_response>
|
84
|
+
EOF
|
85
|
+
|
86
|
+
AUTH_GETSESSION_RESPONSE = <<-EOF
|
87
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
88
|
+
<auth_getSession_response
|
89
|
+
xmlns="http://api.facebook.com/1.0/"
|
90
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
91
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
|
92
|
+
<session_key>5f34e11bfb97c762e439e6a5-8055</session_key>
|
93
|
+
<uid>8055</uid>
|
94
|
+
<expires>1173309298</expires>
|
95
|
+
</auth_getSession_response>
|
96
|
+
EOF
|
97
|
+
|
98
|
+
GROUP_GETMEMBERS_RESPONSE = <<-EOF
|
99
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
100
|
+
<groups_getMembers_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">
|
101
|
+
<members list="true">
|
102
|
+
<uid>4567</uid>
|
103
|
+
<uid>5678</uid>
|
104
|
+
<uid>6789</uid>
|
105
|
+
<uid>7890</uid>
|
106
|
+
</members>
|
107
|
+
<admins list="true">
|
108
|
+
<uid>1234567</uid>
|
109
|
+
</admins>
|
110
|
+
<officers list="true"/>
|
111
|
+
<not_replied list="true"/>
|
112
|
+
</groups_getMembers_response>
|
113
|
+
EOF
|
114
|
+
|
115
|
+
USERS_GETLOGGEDINUSER_RESPONSE = <<-EOF
|
116
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
117
|
+
<users_getLoggedInUser_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">1234567</users_getLoggedInUser_response>
|
118
|
+
EOF
|
119
|
+
|
120
|
+
USERS_GETINFO_RESPONSE = <<-EOF
|
121
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
122
|
+
<users_getInfo_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" list="true">
|
123
|
+
<user>
|
124
|
+
<uid>8055</uid>
|
125
|
+
<about_me>This field perpetuates the glorification of the ego. Also, it has a character limit.</about_me>
|
126
|
+
<activities>Here: facebook, etc. There: Glee Club, a capella, teaching.</activities>
|
127
|
+
<affiliations list="true">
|
128
|
+
<affiliation>
|
129
|
+
<nid>50453093</nid>
|
130
|
+
<name>Facebook Developers</name>
|
131
|
+
<type>work</type>
|
132
|
+
<status/>
|
133
|
+
<year/>
|
134
|
+
</affiliation>
|
135
|
+
</affiliations>
|
136
|
+
<birthday>November 3</birthday>
|
137
|
+
<books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books>
|
138
|
+
<current_location>
|
139
|
+
<city>Palo Alto</city>
|
140
|
+
<state>CA</state>
|
141
|
+
<country>United States</country>
|
142
|
+
<zip>94303</zip>
|
143
|
+
</current_location>
|
144
|
+
<education_history list="true">
|
145
|
+
<education_info>
|
146
|
+
<name>Harvard</name>
|
147
|
+
<year>2003</year>
|
148
|
+
<concentrations list="true">
|
149
|
+
<concentration>Applied Mathematics</concentration>
|
150
|
+
<concentration>Computer Science</concentration>
|
151
|
+
</concentrations>
|
152
|
+
</education_info>
|
153
|
+
</education_history>
|
154
|
+
<first_name>Dave</first_name>
|
155
|
+
<hometown_location>
|
156
|
+
<city>York</city>
|
157
|
+
<state>PA</state>
|
158
|
+
<country>United States</country>
|
159
|
+
<zip>0</zip>
|
160
|
+
</hometown_location>
|
161
|
+
<hs_info>
|
162
|
+
<hs1_name>Central York High School</hs1_name>
|
163
|
+
<hs2_name/>
|
164
|
+
<grad_year>1999</grad_year>
|
165
|
+
<hs1_id>21846</hs1_id>
|
166
|
+
<hs2_id>0</hs2_id>
|
167
|
+
</hs_info>
|
168
|
+
<is_app_user>1</is_app_user>
|
169
|
+
<has_added_app>1</has_added_app>
|
170
|
+
<interests>coffee, computers, the funny, architecture, code breaking,snowboarding, philosophy, soccer, talking to strangers</interests>
|
171
|
+
<last_name>Fetterman</last_name>
|
172
|
+
<meeting_for list="true">
|
173
|
+
<seeking>Friendship</seeking>
|
174
|
+
</meeting_for>
|
175
|
+
<meeting_sex list="true">
|
176
|
+
<sex>female</sex>
|
177
|
+
</meeting_sex>
|
178
|
+
<movies>Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space </movies>
|
179
|
+
<music>New Found Glory, Daft Punk, Weezer, The Crystal Method, Rage, the KLF, Green Day, Live, Coldplay, Panic at the Disco, Family Force 5</music>
|
180
|
+
<name>Dave Fetterman</name>
|
181
|
+
<notes_count>0</notes_count>
|
182
|
+
<pic>http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg</pic>
|
183
|
+
<pic_big>http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg</pic>
|
184
|
+
<pic_small>http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg</pic>
|
185
|
+
<pic_square>http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg</pic>
|
186
|
+
<political>Moderate</political>
|
187
|
+
<profile_update_time>1170414620</profile_update_time>
|
188
|
+
<quotes/>
|
189
|
+
<relationship_status>In a Relationship</relationship_status>
|
190
|
+
<religion/>
|
191
|
+
<sex>male</sex>
|
192
|
+
<significant_other_id xsi:nil="true"/>
|
193
|
+
<status>
|
194
|
+
<message/>
|
195
|
+
<time>0</time>
|
196
|
+
</status>
|
197
|
+
<timezone>-8</timezone>
|
198
|
+
<tv>cf. Bob Trahan</tv>
|
199
|
+
<wall_count>121</wall_count>
|
200
|
+
<work_history list="true">
|
201
|
+
<work_info>
|
202
|
+
<location>
|
203
|
+
<city>Palo Alto</city>
|
204
|
+
<state>CA</state>
|
205
|
+
<country>United States</country>
|
206
|
+
</location>
|
207
|
+
<company_name>Facebook</company_name>
|
208
|
+
<position>Software Engineer</position>
|
209
|
+
<description>Tech Lead, Facebook Platform</description>
|
210
|
+
<start_date>2006-01</start_date>
|
211
|
+
<end_date/>
|
212
|
+
</work_info>
|
213
|
+
</work_history>
|
214
|
+
</user>
|
215
|
+
</users_getInfo_response>
|
216
|
+
EOF
|
217
|
+
end
|
218
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rplatform
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Curtis Edmond
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-06-19 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.6.0
|
23
|
+
version:
|
24
|
+
description: ruby interface for Facebook's Platform API.
|
25
|
+
email: curtis.edmond@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- HISTORY.txt
|
32
|
+
- README.txt
|
33
|
+
files:
|
34
|
+
- CHANGELOG
|
35
|
+
- HISTORY.txt
|
36
|
+
- Rakefile
|
37
|
+
- README.txt
|
38
|
+
- lib/facebook_desktop_session.rb
|
39
|
+
- lib/facebook_session.rb
|
40
|
+
- lib/facebook_web_session.rb
|
41
|
+
- lib/facepricot.rb
|
42
|
+
- lib/rfacebook.rb
|
43
|
+
- test/facebook_desktop_session_test.rb
|
44
|
+
- test/facebook_session_test_methods.rb
|
45
|
+
- test/facebook_web_session_test.rb
|
46
|
+
- test/test_helper.rb
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://rplatform.rubyforge.org/
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options:
|
51
|
+
- --main
|
52
|
+
- README.txt
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: "0"
|
60
|
+
version:
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project: rplatform
|
70
|
+
rubygems_version: 1.1.0
|
71
|
+
signing_key:
|
72
|
+
specification_version: 2
|
73
|
+
summary: ruby interface for Facebook's Platform API..
|
74
|
+
test_files:
|
75
|
+
- test/test_helper.rb
|