tehcurtis-rplatform 0.0.1

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.
@@ -0,0 +1,48 @@
1
+ # Copyright (c) 2007, Matt Pizzimenti (www.livelearncode.com)
2
+ # All rights reserved.
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without modification,
5
+ # are permitted provided that the following conditions are met:
6
+ #
7
+ # Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # Neither the name of the original author nor the names of contributors
15
+ # may be used to endorse or promote products derived from this software
16
+ # without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ #
29
+
30
+ require File.dirname(__FILE__) + '/facebook_session_test_methods'
31
+
32
+ class FacebookWebSessionTest < Test::Unit::TestCase
33
+
34
+ include FacebookSessionTestMethods
35
+
36
+ def setup
37
+ @fbsession = RFacebook::FacebookWebSession.new(RFacebook::Dummy::API_KEY, RFacebook::Dummy::API_SECRET)
38
+ end
39
+
40
+ def test_should_return_install_url
41
+ assert_equal "http://www.facebook.com/install.php?api_key=#{RFacebook::Dummy::API_KEY}", @fbsession.get_install_url
42
+ end
43
+
44
+ def test_should_return_login_url
45
+ assert_equal "http://www.facebook.com/login.php?v=1.0&api_key=#{RFacebook::Dummy::API_KEY}", @fbsession.get_login_url
46
+ end
47
+
48
+ end
@@ -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,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tehcurtis-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: hpricot
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">"
21
+ - !ruby/object:Gem::Version
22
+ version: 0.4.0
23
+ version:
24
+ description: rPlatform is a ruby interface for Facebook's Platform API. Compatible with any site that implements Facebook's Platform.
25
+ email: curtis.edmond@gmail.com
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.txt
32
+ files:
33
+ - README
34
+ - rplatform.gemspec
35
+ - lib/facebook_desktop_session.rb
36
+ - lib/facebook_session.rb
37
+ - lib/facebook_web_session.rb
38
+ - lib/facepricot.rb
39
+ - lib/rfacebook.rb
40
+ - test/facebook_desktop_session_test.rb
41
+ - test/facebook_session_test_methods.rb
42
+ - test/facebook_web_session_test.rb
43
+ - test/test_helper.rb
44
+ - README.txt
45
+ has_rdoc: true
46
+ homepage: http://github.com/tehcurtis/rplatform/
47
+ post_install_message:
48
+ rdoc_options:
49
+ - --main
50
+ - README.txt
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ version:
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.0.1
69
+ signing_key:
70
+ specification_version: 2
71
+ summary: ruby iterface to Facebook's Platform API
72
+ test_files:
73
+ - test/facebook_desktop_session_test.rb
74
+ - test/facebook_session_test_methods.rb
75
+ - test/facebook_web_session_test.rb
76
+ - test/test_helper.rb