psn_trophies 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,163 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Mon, 10 Oct 2011 02:13:49 GMT
3
+ Server: Apache
4
+ Content-Length: 5660
5
+ Set-Cookie: JSESSIONID=TMWhTSJdL9vHHlbm88JTssVLpKQxWHflTppfGh5tryMp78nZPvC6!1120965157; path=/
6
+ Content-Language: en-US
7
+ X-Powered-By: Servlet/2.5 JSP/2.1
8
+ Content-Type: text/html; charset=UTF-8
9
+ Set-Cookie: SONYCOOKIE1=593799360.20480.0000; path=/
10
+
11
+
12
+
13
+
14
+
15
+ <?xml version="1.0" encoding="UTF-8"?>
16
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
17
+
18
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
19
+
20
+
21
+
22
+
23
+
24
+
25
+ <head>
26
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
27
+ <link rel="shortcut icon" href="http://webassets.scea.com/playstation/assets/favicon.ico"/ type="image/x-icon">
28
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/reset.css" type="text/css" media="screen" charset="utf-8"/>
29
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/global.css" type="text/css" media="screen" charset="utf-8"/>
30
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/modules.css" type="text/css" media="screen" charset="utf-8"/>
31
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/additional.css" type="text/css" media="screen" charset="utf-8"/>
32
+ <!--[if lte IE 7]>
33
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/ie.css" type="text/css" media="screen" charset="utf-8"/>
34
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/additionalie.css" type="text/css" media="screen" charset="utf-8"/>
35
+ <![endif]-->
36
+
37
+ <link rel="stylesheet" href="http://webassets.scea.com/playstation/assets/css/temp.css" type="text/css" media="screen" charset="utf-8"/>
38
+
39
+ <link rel="stylesheet" type="text/css" media="all" href="http://webassets.scea.com/playstation/stylesheets/lightview.css"/>
40
+ <link rel="stylesheet" type="text/css" media="all" href="http://webassets.scea.com/playstation/stylesheets/prototip.css"/>
41
+ <link rel="stylesheet" type="text/css" media="all" href="http://webassets.scea.com/playstation/stylesheets/trophies.css"/>
42
+
43
+ <!--[if lt IE 7]>
44
+ <link rel="stylesheet" type="text/css" media="all" href="http://webassets.scea.com/playstation/stylesheets/bie6.css"/>
45
+ <![endif]-->
46
+ <!--[if (gte IE 7)]>
47
+ <link rel="stylesheet" type="text/css" media="all" href="http://webassets.scea.com/playstation/stylesheets/bie7.css"/>
48
+ <![endif]-->
49
+
50
+ <script type="text/javascript" charset="utf-8" src="http://webassets.scea.com/playstation/assets/js/swfobject.js"></script>
51
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/protoaculous.1.8.2.p1.6.1_rc3.min_patch.js"></script>
52
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/lightview.js"></script>
53
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/prototip.js"></script>
54
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/livepipe/livepipe.js"></script>
55
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/livepipe/scrollbar.js"></script>
56
+
57
+ <script type="text/javascript" src="http://webassets.scea.com/playstation/javascripts/application.js"></script>
58
+
59
+ <script src="http://webassets.scea.com/playstation/assets/js/AC_RunActiveContent.js" type="text/javascript"></script>
60
+ <title></title>
61
+
62
+ <script type="text/javascript">
63
+ var busyPath = "/playstation/pages/busy.html";
64
+ </script>
65
+ </head>
66
+ <body>
67
+ <!-- /main -->
68
+ <div id="main" name="main" class="clearfix">
69
+ <!-- breadcrumb -->
70
+
71
+
72
+
73
+ <div id="breadcrumb">
74
+ <h3 style="font-size:18px;"> </h3>
75
+ </div>
76
+
77
+
78
+
79
+
80
+
81
+ <!-- /breadcrumb -->
82
+ <!-- <div class="share">
83
+ <a href="#" id="overlayShare" onclick="alert('implement')"><span>Share this</span></a>
84
+ </div> -->
85
+ <!-- content -->
86
+ <div id="trophiescontent">
87
+
88
+
89
+
90
+ <script>
91
+
92
+ function getDocHeight()
93
+ {
94
+ var D = document;
95
+ var agt=navigator.userAgent.toLowerCase();
96
+
97
+ return Math.max(
98
+ Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
99
+ Math.max(D.body.offsetHeight, D.documentElement.offsetHeight)
100
+
101
+ );
102
+ }
103
+
104
+ function setIFrameHeightToCookie(cookieValue,iframeId)
105
+ {
106
+ var formHeight = getDocHeight();
107
+ var agt=navigator.userAgent.toLowerCase();
108
+
109
+ if (agt.indexOf("opera") != -1 || agt.indexOf("safari") != -1)
110
+ {
111
+ var D = document;
112
+ formHeight =Math.max(
113
+ Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
114
+ Math.max(D.body.offsetHeight, D.documentElement.offsetHeight));
115
+ }
116
+ else
117
+ formHeight =document.getElementById('main').scrollHeight+200;
118
+ var iFrame = window.parent.document.getElementById(iframeId);
119
+
120
+ if (formHeight != null && iFrame !=null)
121
+ {
122
+ iFrame.height = eval(formHeight) ;
123
+
124
+ if(iFrame.style.height=='Nan' || iFrame.style.height=='0')
125
+ {
126
+ iFrame.style.height = '200px';
127
+ }
128
+ }
129
+ else if (iFrame !=null)
130
+ {
131
+ iFrame.height = '200px';
132
+ }
133
+ }
134
+
135
+ setIFrameHeightToCookie('page-height','profileFrame');
136
+ </script>
137
+
138
+ <div class="trophiescontainer">
139
+ <div class="trophiesinnermodule">
140
+ <div class="top_left"></div>
141
+ <div class="errorSection">
142
+ <h2 align="center">No User Profile</h2>
143
+ <h4 align="center">The user you're looking for does not have a profile</h4>
144
+ </div>
145
+ </div>
146
+ </div>
147
+ </div><!-- /content -->
148
+
149
+
150
+
151
+ <p class="profile_note">Note: The above information is dependent on the proper functioning of the PlayStation®Network. Information is not updated in real time.</p>
152
+
153
+ <div id="tipHolder" style="display:none;"></div>
154
+ </div>
155
+ <!-- /main -->
156
+ </body>
157
+
158
+ <script>
159
+ if(parent.document.getElementById('profileFrame')!=null){
160
+ }
161
+ </script>
162
+ </html>
163
+
@@ -0,0 +1,60 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'minitest/autorun'
4
+ require 'minitest/spec'
5
+ require 'fakeweb'
6
+
7
+ require 'minitest/reporters'
8
+ MiniTest::Unit.runner = MiniTest::SuiteRunner.new
9
+ MiniTest::Unit.runner.reporters << MiniTest::Reporters::SpecReporter.new
10
+
11
+ require 'psn_trophies'
12
+
13
+ =begin
14
+ Tip for getting fixtures:
15
+
16
+ $ curl -is -e "http://us.playstation.com/publictrophy/index.htm?onlinename=LeiteBR/trophies" "http://us.playstation.com/playstation/psn/profile/LeiteBR/get_ordered_trophies_data" > test/fixtures/success.html
17
+
18
+ =end
19
+
20
+
21
+ describe PsnTrophies do
22
+
23
+ before { FakeWeb.allow_net_connect = false }
24
+ after { FakeWeb.allow_net_connect = true }
25
+
26
+ describe "valid PSN id" do
27
+
28
+ before do
29
+ profile = File.read("test/fixtures/profile_leitebr.html")
30
+ trophies = File.read("test/fixtures/profile_leitebr_trophies.html")
31
+
32
+ FakeWeb.register_uri(:get, "http://us.playstation.com/playstation/psn/profiles/LeiteBR", :response => profile)
33
+ FakeWeb.register_uri(:get, "http://us.playstation.com/playstation/psn/profile/LeiteBR/get_ordered_trophies_data", :response => trophies)
34
+ end
35
+
36
+ it "should retrieve a list of played games" do
37
+ client = PsnTrophies::Client.new
38
+ played_games = client.trophies("LeiteBR")
39
+
40
+ played_games.wont_be_empty
41
+ played_games.first.title.must_equal "Dragon Age II"
42
+ end
43
+ end
44
+
45
+ describe "invalid PSN user" do
46
+
47
+ before do
48
+ profile = File.read("test/fixtures/profile_nonexistinvaliduser.html")
49
+ FakeWeb.register_uri(:get, "http://us.playstation.com/playstation/psn/profiles/NonExistInvalidUser", :response => profile)
50
+ end
51
+
52
+ it "should raise exception" do
53
+ client = PsnTrophies::Client.new
54
+ lambda {
55
+ played_games = client.trophies("NonExistInvalidUser")
56
+ }.must_raise(PsnTrophies::NoUserProfileError)
57
+ end
58
+ end
59
+
60
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psn_trophies
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roger Leite
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-09 00:00:00 -03:00
19
- default_executable:
18
+ date: 2012-06-11 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: nokogiri
@@ -34,6 +33,48 @@ dependencies:
34
33
  version: 1.5.0
35
34
  type: :runtime
36
35
  version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: minitest
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ type: :development
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: minitest-reporters
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :development
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: fakeweb
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ type: :development
77
+ version_requirements: *id004
37
78
  description: Parser for PSN Trophies site
38
79
  email:
39
80
  - roger.barreto@gmail.com
@@ -53,7 +94,10 @@ files:
53
94
  - lib/psn_trophies.rb
54
95
  - lib/psn_trophies/version.rb
55
96
  - psn_trophies.gemspec
56
- has_rdoc: true
97
+ - test/fixtures/profile_leitebr.html
98
+ - test/fixtures/profile_leitebr_trophies.html
99
+ - test/fixtures/profile_nonexistinvaliduser.html
100
+ - test/test_psn_trophies.rb
57
101
  homepage: ""
58
102
  licenses: []
59
103
 
@@ -83,9 +127,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
127
  requirements: []
84
128
 
85
129
  rubyforge_project: psn_trophies
86
- rubygems_version: 1.4.1
130
+ rubygems_version: 1.8.15
87
131
  signing_key:
88
132
  specification_version: 3
89
133
  summary: Parser for PSN Trophies site
90
- test_files: []
91
-
134
+ test_files:
135
+ - test/fixtures/profile_leitebr.html
136
+ - test/fixtures/profile_leitebr_trophies.html
137
+ - test/fixtures/profile_nonexistinvaliduser.html
138
+ - test/test_psn_trophies.rb