qoobaa-opensocial 0.1.8 → 0.2.0

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.
@@ -1,99 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{qoobaa-opensocial}
8
- s.version = "0.1.8"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jakub Kuźma", "Piotr Sarnacki"]
12
- s.date = %q{2010-03-31}
13
- s.description = %q{OpenSocial Google Gem}
14
- s.email = %q{qoobaa@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "NOTICE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/opensocial.rb",
28
- "lib/opensocial/activity.rb",
29
- "lib/opensocial/appdata.rb",
30
- "lib/opensocial/auth/action_controller_request.rb",
31
- "lib/opensocial/auth/base.rb",
32
- "lib/opensocial/base.rb",
33
- "lib/opensocial/connection.rb",
34
- "lib/opensocial/group.rb",
35
- "lib/opensocial/person.rb",
36
- "lib/opensocial/request.rb",
37
- "lib/opensocial/string/merb_string.rb",
38
- "lib/opensocial/string/os_string.rb",
39
- "qoobaa-opensocial.gemspec",
40
- "test/fixtures/activities.json",
41
- "test/fixtures/activity.json",
42
- "test/fixtures/appdata.json",
43
- "test/fixtures/appdatum.json",
44
- "test/fixtures/group.json",
45
- "test/fixtures/groups.json",
46
- "test/fixtures/people.json",
47
- "test/fixtures/person.json",
48
- "test/fixtures/person_appdata_rpc.json",
49
- "test/fixtures/person_rpc.json",
50
- "test/helper.rb",
51
- "test/test_activity.rb",
52
- "test/test_appdata.rb",
53
- "test/test_connection.rb",
54
- "test/test_group.rb",
55
- "test/test_online.rb",
56
- "test/test_person.rb",
57
- "test/test_request.rb",
58
- "test/test_rpcrequest.rb"
59
- ]
60
- s.homepage = %q{http://github.com/qoobaa/opensocial}
61
- s.rdoc_options = ["--charset=UTF-8"]
62
- s.require_paths = ["lib"]
63
- s.rubygems_version = %q{1.3.6}
64
- s.summary = %q{OpenSocial Google Gem}
65
- s.test_files = [
66
- "test/test_request.rb",
67
- "test/test_rpcrequest.rb",
68
- "test/test_connection.rb",
69
- "test/test_appdata.rb",
70
- "test/test_person.rb",
71
- "test/test_activity.rb",
72
- "test/helper.rb",
73
- "test/test_group.rb",
74
- "test/test_online.rb"
75
- ]
76
-
77
- if s.respond_to? :specification_version then
78
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
79
- s.specification_version = 3
80
-
81
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
82
- s.add_runtime_dependency(%q<oauth>, [">= 0"])
83
- s.add_development_dependency(%q<test-unit>, [">= 2"])
84
- s.add_development_dependency(%q<json_pure>, [">= 0"])
85
- s.add_development_dependency(%q<mocha>, [">= 0"])
86
- else
87
- s.add_dependency(%q<oauth>, [">= 0"])
88
- s.add_dependency(%q<test-unit>, [">= 2"])
89
- s.add_dependency(%q<json_pure>, [">= 0"])
90
- s.add_dependency(%q<mocha>, [">= 0"])
91
- end
92
- else
93
- s.add_dependency(%q<oauth>, [">= 0"])
94
- s.add_dependency(%q<test-unit>, [">= 2"])
95
- s.add_dependency(%q<json_pure>, [">= 0"])
96
- s.add_dependency(%q<mocha>, [">= 0"])
97
- end
98
- end
99
-
@@ -1,28 +0,0 @@
1
- {
2
- "totalResults" : 2,
3
- "startIndex" : 0,
4
- "entry" : [
5
- {
6
- "id" : "http://example.org/activities/example.org:87ead8dead6beef/self/af3778",
7
- "title" : { "type" : "html",
8
- "value" : "<a href=\"foo\">some activity</a>"
9
- },
10
- "updated" : "2008-02-20T23:35:37.266Z",
11
- "body" : "Some details for some activity",
12
- "bodyId" : "383777272",
13
- "url" : "http://api.example.org/activity/feeds/.../af3778",
14
- "userId" : "example.org:34KJDCSKJN2HHF0DW20394"
15
- },
16
- {
17
- "id" : "http://example.org/activities/example.org:87ead8dead6beef/self/af3779",
18
- "title" : { "type" : "html",
19
- "value" : "<a href=\"foo\">some activity</a>"
20
- },
21
- "updated" : "2008-02-20T23:35:38.266Z",
22
- "body" : "Some details for some second activity",
23
- "bodyId" : "383777273",
24
- "url" : "http://api.example.org/activity/feeds/.../af3779",
25
- "userId" : "example.org:34KJDCSKJN2HHF0DW20394"
26
- }
27
- ]
28
- }
@@ -1,13 +0,0 @@
1
- {
2
- "entry" : {
3
- "id" : "http://example.org/activities/example.org:87ead8dead6beef/self/af3778",
4
- "title" : { "type" : "html",
5
- "value" : "<a href=\"foo\">some activity</a>"
6
- },
7
- "updated" : "2008-02-20T23:35:37.266Z",
8
- "body" : "Some details for some activity",
9
- "bodyId" : "383777272",
10
- "url" : "http://api.example.org/activity/feeds/.../af3778",
11
- "userId" : "example.org:34KJDCSKJN2HHF0DW20394"
12
- }
13
- }
@@ -1,6 +0,0 @@
1
- {
2
- "entry" : {
3
- "example.org:34KJDCSKJN2HHF0DW20394" : { "pokes" : 3, "last_poke" : "2008-02-13T18:30:02Z" },
4
- "example.org:58UIDCSIOP233FDKK3HD44" : { "pokes" : 2, "last_poke" : "2007-12-16T18:30:02Z" }
5
- }
6
- }
@@ -1,5 +0,0 @@
1
- {
2
- "entry" : {
3
- "example.org:34KJDCSKJN2HHF0DW20394" : { "pokes" : 3, "last_poke" : "2008-02-13T18:30:02Z" }
4
- }
5
- }
@@ -1,7 +0,0 @@
1
- {
2
- "entry" : {
3
- "id" : "example.org:34KJDCSKJN2HHF0DW20394/friends",
4
- "title" : "Peeps",
5
- "link" : {"rel" : "alternate", "href" : "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@friends" }
6
- }
7
- }
@@ -1,16 +0,0 @@
1
- {
2
- "totalResults" : 2,
3
- "startIndex" : 0,
4
- "entry" : [
5
- {
6
- "id" : "example.org:34KJDCSKJN2HHF0DW20394/friends",
7
- "title" : "Peeps",
8
- "link" : {"rel" : "alternate", "href" : "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@friends" }
9
- },
10
- {
11
- "id" : "example.org:34KJDCSKJN2HHF0DW20394/family",
12
- "title" : "Family",
13
- "link" : {"rel" : "alternate", "href" : "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@family" }
14
- }
15
- ]
16
- }
@@ -1,20 +0,0 @@
1
- {
2
- "totalResults" : 2,
3
- "startIndex" : 0,
4
- "entry" : [
5
- {
6
- "id" : "example.org:34KJDCSKJN2HHF0DW20394",
7
- "name" : {"unstructured" : "Jane Doe"},
8
- "gender" : {"displayvalue" : "女性", "key" : "FEMALE"},
9
- "isOwner" : true,
10
- "isViewer" : true
11
- },
12
- {
13
- "id" : "example.org:34KJDCSKJN2HHF0DW20395",
14
- "name" : {"unstructured" : "Jane Doe2"},
15
- "gender" : {"displayvalue" : "女性", "key" : "FEMALE"},
16
- "isOwner" : false,
17
- "isViewer" : false
18
- }
19
- ]
20
- }
@@ -1,9 +0,0 @@
1
- {
2
- "entry" : {
3
- "id" : "example.org:34KJDCSKJN2HHF0DW20394",
4
- "name" : {"unstructured" : "Jane Doe"},
5
- "gender" : {"displayvalue" : "女性", "key" : "FEMALE"},
6
- "isOwner" : true,
7
- "isViewer" : true
8
- }
9
- }
@@ -1 +0,0 @@
1
- [{"id":"data","data":{"orkut.com:242412":{"token":"{\"hash\":{\"key\":\"value\",\"key2\":2},\"integer\":1241}"}}},{"id":"me","data":{"photos":[{"value":"http://www.orkut.com/img/i_nophoto64.gif","type":"thumbnail"}],"id":"orkut.com:242412","isViewer":true,"thumbnailUrl":"http://www.orkut.com/img/i_nophoto64.gif","name":{"familyName":"Testington","givenName":"Sample"},"isOwner":false}}]
@@ -1 +0,0 @@
1
- [{"id":"me","data":{"photos":[{"value":"http://www.orkut.com/img/i_nophoto64.gif","type":"thumbnail"}],"id":"orkut.com:242412","isViewer":true,"thumbnailUrl":"http://www.orkut.com/img/i_nophoto64.gif","name":{"familyName":"Testington","givenName":"Sample"},"isOwner":false}}]
data/test/helper.rb DELETED
@@ -1,41 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require "rubygems"
16
- gem "test-unit"
17
- require "test/unit"
18
- require "mocha"
19
- require "json/pure"
20
- require "oauth"
21
-
22
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
23
- $LOAD_PATH.unshift(File.dirname(__FILE__))
24
- require "opensocial"
25
-
26
- class OpenSocialTestCase < Test::Unit::TestCase
27
- NO_AUTH = { :auth => OpenSocial::Connection::AUTH_ST, :st => "some_value" }
28
-
29
- def load_file(file, join = "")
30
- lines = []
31
- open(File.dirname(__FILE__) + "/fixtures/" + file) do |f|
32
- f.each_line { |line| lines << line }
33
- end
34
-
35
- return lines.join(join)
36
- end
37
-
38
- def load_json(file)
39
- JSON.parse(load_file(file))
40
- end
41
- end
@@ -1,105 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.dirname(__FILE__) + "/helper.rb"
16
-
17
- class TestActivity < OpenSocialTestCase
18
- def test_initialization
19
- json = load_json("activity.json")
20
- activity = OpenSocial::Activity.new(json["entry"])
21
-
22
- assert_equal "http://example.org/activities/example.org:87ead8dead6beef/self/af3778", activity.id
23
- assert_equal String, activity.id.class
24
-
25
- assert_equal Hash, activity.title.class
26
- assert_equal "html", activity.title["type"]
27
- assert_equal '<a href="foo">some activity</a>', activity.title["value"]
28
-
29
- assert_equal String, activity.updated.class
30
- assert_equal "2008-02-20T23:35:37.266Z", activity.updated
31
-
32
- assert_equal String, activity.body.class
33
- assert_equal "Some details for some activity", activity.body
34
-
35
- assert_equal String, activity.body_id.class
36
- assert_equal "383777272", activity.body_id
37
-
38
- assert_equal String, activity.url.class
39
- assert_equal "http://api.example.org/activity/feeds/.../af3778", activity.url
40
-
41
- assert_equal String, activity.user_id.class
42
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394", activity.user_id
43
- end
44
-
45
- def test_fetch_groups_request
46
- json = load_json("activities.json")
47
-
48
- c = OpenSocial::Connection.new(NO_AUTH)
49
- request = OpenSocial::FetchActivitiesRequest.new(c)
50
- request.stubs(:send_request).returns(json)
51
- activities = request.send
52
-
53
- # Check properties of the collection
54
- assert_equal OpenSocial::Collection, activities.class
55
- assert_equal 2, activities.length
56
-
57
- # Check properties of the first activity
58
- first = activities["http://example.org/activities/example.org:87ead8dead6beef/self/af3778"]
59
- assert_equal "http://example.org/activities/example.org:87ead8dead6beef/self/af3778", first.id
60
- assert_equal String, first.id.class
61
-
62
- assert_equal Hash, first.title.class
63
- assert_equal "html", first.title["type"]
64
- assert_equal '<a href="foo">some activity</a>', first.title["value"]
65
-
66
- assert_equal String, first.updated.class
67
- assert_equal "2008-02-20T23:35:37.266Z", first.updated
68
-
69
- assert_equal String, first.body.class
70
- assert_equal "Some details for some activity", first.body
71
-
72
- assert_equal String, first.body_id.class
73
- assert_equal "383777272", first.body_id
74
-
75
- assert_equal String, first.url.class
76
- assert_equal "http://api.example.org/activity/feeds/.../af3778", first.url
77
-
78
- assert_equal String, first.user_id.class
79
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394", first.user_id
80
-
81
- # Check properties of the second activity
82
- second = activities["http://example.org/activities/example.org:87ead8dead6beef/self/af3779"]
83
- assert_equal "http://example.org/activities/example.org:87ead8dead6beef/self/af3779", second.id
84
- assert_equal String, second.id.class
85
-
86
- assert_equal Hash, second.title.class
87
- assert_equal "html", second.title["type"]
88
- assert_equal '<a href="foo">some activity</a>', second.title["value"]
89
-
90
- assert_equal String, second.updated.class
91
- assert_equal "2008-02-20T23:35:38.266Z", second.updated
92
-
93
- assert_equal String, second.body.class
94
- assert_equal "Some details for some second activity", second.body
95
-
96
- assert_equal String, second.body_id.class
97
- assert_equal "383777273", second.body_id
98
-
99
- assert_equal String, second.url.class
100
- assert_equal "http://api.example.org/activity/feeds/.../af3779", second.url
101
-
102
- assert_equal String, second.user_id.class
103
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394", second.user_id
104
- end
105
- end
data/test/test_appdata.rb DELETED
@@ -1,57 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.dirname(__FILE__) + "/helper.rb"
16
-
17
- class TestAppData < OpenSocialTestCase
18
- def test_initialization
19
- json = load_json("appdatum.json")
20
- appdata = OpenSocial::AppData.new("test", json["entry"]["example.org:34KJDCSKJN2HHF0DW20394"])
21
-
22
- assert_equal Fixnum, appdata.pokes.class
23
- assert_equal 3, appdata.pokes
24
-
25
- assert_equal String, appdata.last_poke.class
26
- assert_equal "2008-02-13T18:30:02Z", appdata.last_poke
27
- end
28
-
29
- def test_fetch_appdata_request
30
- json = load_json("appdata.json")
31
-
32
- c = OpenSocial::Connection.new(NO_AUTH)
33
- request = OpenSocial::FetchAppDataRequest.new(c)
34
- request.stubs(:send_request).returns(json)
35
- appdata = request.send
36
-
37
- # Check properties of the collection
38
- assert_equal OpenSocial::Collection, appdata.class
39
- assert_equal 2, appdata.length
40
-
41
- # Check properties of the first appdatum
42
- first = appdata["example.org:34KJDCSKJN2HHF0DW20394"]
43
- assert_equal Fixnum, first.pokes.class
44
- assert_equal 3, first.pokes
45
-
46
- assert_equal String, first.last_poke.class
47
- assert_equal "2008-02-13T18:30:02Z", first.last_poke
48
-
49
- # Check properties of the second appdatum
50
- second = appdata["example.org:58UIDCSIOP233FDKK3HD44"]
51
- assert_equal Fixnum, second.pokes.class
52
- assert_equal 2, second.pokes
53
-
54
- assert_equal String, second.last_poke.class
55
- assert_equal "2007-12-16T18:30:02Z", second.last_poke
56
- end
57
- end
@@ -1,52 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.dirname(__FILE__) + "/helper.rb"
16
-
17
- class TestConnection < OpenSocialTestCase
18
- # Tests that a connection properly throws an exception invalid parameters are
19
- # supplied
20
- def test_invalid_connection_parameters
21
- non_blank = "foo"
22
-
23
- pass_invalid_hmac_parameters(non_blank, "", "")
24
- pass_invalid_hmac_parameters("", non_blank, "")
25
- pass_invalid_hmac_parameters("", "", non_blank)
26
-
27
- assert_nothing_raised ArgumentError do
28
- c = OpenSocial::Connection.new(:consumer_key => non_blank,
29
- :consumer_secret => non_blank,
30
- :xoauth_requestor_id => "")
31
- end
32
-
33
- assert_raise ArgumentError do
34
- c = OpenSocial::Connection.new(:auth => OpenSocial::Connection::AUTH_ST,
35
- :st => "")
36
- end
37
-
38
- assert_raise ArgumentError do
39
- c = OpenSocial::Connection.new(:auth => 1234124)
40
- end
41
- end
42
-
43
- private
44
-
45
- def pass_invalid_hmac_parameters(key, secret, id)
46
- assert_raise ArgumentError do
47
- c = OpenSocial::Connection.new(:consumer_key => key,
48
- :consumer_secret => secret,
49
- :xoauth_requestor_id => id)
50
- end
51
- end
52
- end
data/test/test_group.rb DELETED
@@ -1,70 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.dirname(__FILE__) + "/helper.rb"
16
-
17
- class TestGroup < OpenSocialTestCase
18
- # Tests construction of a group from a JSON entry
19
- def test_initialization
20
- json = load_json("group.json")
21
- group = OpenSocial::Group.new(json["entry"])
22
-
23
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394/friends", group.id
24
- assert_equal String, group.id.class
25
-
26
- assert_equal "Peeps", group.title
27
- assert_equal String, group.title.class
28
-
29
- assert_equal Hash, group.link.class
30
- assert_equal "alternate", group.link["rel"]
31
- assert_equal "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@friends", group.link["href"]
32
- end
33
-
34
- def test_fetch_groups_request
35
- json = load_json("groups.json")
36
-
37
- c = OpenSocial::Connection.new(NO_AUTH)
38
- request = OpenSocial::FetchGroupsRequest.new(c)
39
- request.stubs(:send_request).returns(json)
40
- groups = request.send
41
-
42
- # Check properties of the collection
43
- assert_equal OpenSocial::Collection, groups.class
44
- assert_equal 2, groups.length
45
-
46
- # Check properties of the first group
47
- first = groups["example.org:34KJDCSKJN2HHF0DW20394/friends"]
48
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394/friends", first.id
49
- assert_equal String, first.id.class
50
-
51
- assert_equal "Peeps", first.title
52
- assert_equal String, first.title.class
53
-
54
- assert_equal Hash, first.link.class
55
- assert_equal "alternate", first.link["rel"]
56
- assert_equal "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@friends", first.link["href"]
57
-
58
- # Check properties of the second group
59
- second = groups["example.org:34KJDCSKJN2HHF0DW20394/family"]
60
- assert_equal "example.org:34KJDCSKJN2HHF0DW20394/family", second.id
61
- assert_equal String, second.id.class
62
-
63
- assert_equal "Family", second.title
64
- assert_equal String, second.title.class
65
-
66
- assert_equal Hash, second.link.class
67
- assert_equal "alternate", second.link["rel"]
68
- assert_equal "http://api.example.org/people/example.org:34KJDCSKJN2HHF0DW20394/@family", second.link["href"]
69
- end
70
- end
data/test/test_online.rb DELETED
@@ -1,67 +0,0 @@
1
- # Copyright (c) 2008 Google Inc.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- require File.dirname(__FILE__) + "/helper.rb"
16
-
17
- class TestOnline < OpenSocialTestCase
18
- # Tests a simple REST request
19
- def test_online_rest
20
- consumer_key = "orkut.com:623061448914"
21
- consumer_secret = "uynAeXiWTisflWX99KU1D2q5"
22
- requestor = "03067092798963641994"
23
- c = OpenSocial::Connection.new(:consumer_key => consumer_key, :consumer_secret => consumer_secret, :xoauth_requestor_id => requestor)
24
- r = OpenSocial::FetchPersonRequest.new(c)
25
- person = r.send
26
-
27
- assert_equal OpenSocial::Person, person.class
28
- end
29
-
30
- # Tests a simple RPC request
31
- def test_online_rpc
32
- consumer_key = "orkut.com:623061448914"
33
- consumer_secret = "uynAeXiWTisflWX99KU1D2q5"
34
- requestor = "03067092798963641994"
35
- c = OpenSocial::Connection.new(:consumer_key => consumer_key, :consumer_secret => consumer_secret, :xoauth_requestor_id => requestor)
36
- r = OpenSocial::RpcRequest.new(c)
37
- r.add(:data => OpenSocial::FetchAppDataRequest.new)
38
- data = r.send[:data]
39
-
40
- assert_equal OpenSocial::Collection, data.class
41
- end
42
-
43
- # Test an unauthorized REST request
44
- def test_unauthorized_rest_request
45
- consumer_key = "foo"
46
- consumer_secret = "bar"
47
- requestor = "baz"
48
- c = OpenSocial::Connection.new(:consumer_key => consumer_key, :consumer_secret => consumer_secret, :xoauth_requestor_id => requestor)
49
- r = OpenSocial::FetchPersonRequest.new(c)
50
- assert_raise OpenSocial::AuthException do
51
- person = r.send
52
- end
53
- end
54
-
55
- # Test an unauthorized RPC request
56
- def test_unauthorized_rpc_request
57
- consumer_key = "foo"
58
- consumer_secret = "bar"
59
- requestor = "baz"
60
- c = OpenSocial::Connection.new(:consumer_key => consumer_key, :consumer_secret => consumer_secret, :xoauth_requestor_id => requestor)
61
- r = OpenSocial::RpcRequest.new(c)
62
- r.add(:data => OpenSocial::FetchAppDataRequest.new)
63
- assert_raise OpenSocial::AuthException do
64
- data = r.send[:data]
65
- end
66
- end
67
- end