psn 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/psn.rb +11 -0
- data/lib/psn/api.rb +38 -0
- data/lib/psn/game.rb +13 -0
- data/lib/psn/games_list.rb +20 -0
- data/lib/psn/user.rb +23 -0
- data/lib/psn/version.rb +3 -0
- data/psn.gemspec +28 -0
- data/spec/cassettes/PSN_API/fetches_games_for_an_user.yml +952 -0
- data/spec/cassettes/PSN_API/fetches_player_summaries_for_an_user.yml +58 -0
- data/spec/cassettes/PSN_Game/finds_the_correct_id.yml +952 -0
- data/spec/cassettes/PSN_Game/finds_the_correct_name.yml +952 -0
- data/spec/cassettes/PSN_GamesList/creates_game_objects.yml +952 -0
- data/spec/cassettes/PSN_GamesList/has_the_right_amount_of_games.yml +952 -0
- data/spec/cassettes/PSN_User/avatar/has_an_avatar.yml +58 -0
- data/spec/cassettes/PSN_User/games/fetches_the_right_amount_of_games.yml +952 -0
- data/spec/psn/api_spec.rb +17 -0
- data/spec/psn/game_spec.rb +13 -0
- data/spec/psn/games_list_spec.rb +13 -0
- data/spec/psn/user_spec.rb +23 -0
- data/spec/spec_helper.rb +17 -0
- metadata +223 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'psn/api'
|
3
|
+
|
4
|
+
module PSN
|
5
|
+
describe API do
|
6
|
+
let(:api) { API.new }
|
7
|
+
let(:user) { User.new("RazrPSN") }
|
8
|
+
|
9
|
+
it "fetches player summaries for an user", :vcr do
|
10
|
+
api.player_summaries_for(user).should be_a_kind_of Nokogiri::XML::Document
|
11
|
+
end
|
12
|
+
|
13
|
+
it "fetches games for an user", :vcr do
|
14
|
+
api.games_for(user).should be_a_kind_of Nokogiri::XML::NodeSet
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module PSN
|
3
|
+
describe Game, :vcr do
|
4
|
+
let(:user) { User.new('RazrPSN') }
|
5
|
+
let (:game) {GamesList.new(user).games.first}
|
6
|
+
it "finds the correct id" do
|
7
|
+
game.id.should == "NPWR03002_00"
|
8
|
+
end
|
9
|
+
it "finds the correct name" do
|
10
|
+
game.name.should == "Tales from Space: Mutant Blobs Attack"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
module PSN
|
3
|
+
describe GamesList, :vcr do
|
4
|
+
let(:user) { User.new("RazrPSN") }
|
5
|
+
let(:games) {GamesList.new(user).games}
|
6
|
+
it "has the right amount of games" do
|
7
|
+
games.count.should == 46
|
8
|
+
end
|
9
|
+
it "creates game objects" do
|
10
|
+
games.all?{|g| g.should be_a_kind_of Game}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'psn/user'
|
3
|
+
|
4
|
+
module PSN
|
5
|
+
describe User do
|
6
|
+
it 'stores the id', :vcr do
|
7
|
+
User.new("RazrPSN").id.should == "RazrPSN"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "avatar", :vcr do
|
11
|
+
it "has an avatar" do
|
12
|
+
User.new("RazrPSN").avatar.should == "http://static-resource.np.community.playstation.net/avatar/WWS_E/E0039.png"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
describe "games", :vcr do
|
17
|
+
let(:games) {User.new("RazrPSN").games}
|
18
|
+
it "fetches the right amount of games" do
|
19
|
+
games.count.should == 46
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'psn'
|
2
|
+
require 'vcr'
|
3
|
+
|
4
|
+
VCR.configure do |config|
|
5
|
+
config.cassette_library_dir = 'spec/cassettes'
|
6
|
+
config.hook_into :webmock
|
7
|
+
config.default_cassette_options = { record: :new_episodes }
|
8
|
+
config.configure_rspec_metadata!
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
config.extend VCR::RSpec::Macros
|
16
|
+
config.order = 'random'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,223 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: psn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pedro Nascimento
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>'
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3'
|
20
|
+
none: false
|
21
|
+
prerelease: false
|
22
|
+
name: activesupport
|
23
|
+
requirement: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>'
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '3'
|
28
|
+
none: false
|
29
|
+
type: :runtime
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.5.5
|
36
|
+
none: false
|
37
|
+
prerelease: false
|
38
|
+
name: nokogiri
|
39
|
+
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.5.5
|
44
|
+
none: false
|
45
|
+
type: :runtime
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ~>
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 1.3.3
|
52
|
+
none: false
|
53
|
+
prerelease: false
|
54
|
+
name: retriable
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.3.3
|
60
|
+
none: false
|
61
|
+
type: :runtime
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 10.0.1
|
68
|
+
none: false
|
69
|
+
prerelease: false
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 10.0.1
|
76
|
+
none: false
|
77
|
+
type: :development
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
none: false
|
85
|
+
prerelease: false
|
86
|
+
name: pry
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ! '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
none: false
|
93
|
+
type: :development
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.12.0
|
100
|
+
none: false
|
101
|
+
prerelease: false
|
102
|
+
name: rspec
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ~>
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 2.12.0
|
108
|
+
none: false
|
109
|
+
type: :development
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ~>
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 2.3.0
|
116
|
+
none: false
|
117
|
+
prerelease: false
|
118
|
+
name: vcr
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ~>
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 2.3.0
|
124
|
+
none: false
|
125
|
+
type: :development
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>'
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.8.0
|
132
|
+
- - <
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.9.0
|
135
|
+
none: false
|
136
|
+
prerelease: false
|
137
|
+
name: webmock
|
138
|
+
requirement: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ! '>'
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.8.0
|
143
|
+
- - <
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.9.0
|
146
|
+
none: false
|
147
|
+
type: :development
|
148
|
+
description: PSN allows you to interact with the Playstation Network.
|
149
|
+
email:
|
150
|
+
- pedro@helabs.com.br
|
151
|
+
executables: []
|
152
|
+
extensions: []
|
153
|
+
extra_rdoc_files: []
|
154
|
+
files:
|
155
|
+
- .gitignore
|
156
|
+
- Gemfile
|
157
|
+
- LICENSE.txt
|
158
|
+
- README.md
|
159
|
+
- Rakefile
|
160
|
+
- lib/psn.rb
|
161
|
+
- lib/psn/api.rb
|
162
|
+
- lib/psn/game.rb
|
163
|
+
- lib/psn/games_list.rb
|
164
|
+
- lib/psn/user.rb
|
165
|
+
- lib/psn/version.rb
|
166
|
+
- psn.gemspec
|
167
|
+
- spec/cassettes/PSN_API/fetches_games_for_an_user.yml
|
168
|
+
- spec/cassettes/PSN_API/fetches_player_summaries_for_an_user.yml
|
169
|
+
- spec/cassettes/PSN_Game/finds_the_correct_id.yml
|
170
|
+
- spec/cassettes/PSN_Game/finds_the_correct_name.yml
|
171
|
+
- spec/cassettes/PSN_GamesList/creates_game_objects.yml
|
172
|
+
- spec/cassettes/PSN_GamesList/has_the_right_amount_of_games.yml
|
173
|
+
- spec/cassettes/PSN_User/avatar/has_an_avatar.yml
|
174
|
+
- spec/cassettes/PSN_User/games/fetches_the_right_amount_of_games.yml
|
175
|
+
- spec/psn/api_spec.rb
|
176
|
+
- spec/psn/game_spec.rb
|
177
|
+
- spec/psn/games_list_spec.rb
|
178
|
+
- spec/psn/user_spec.rb
|
179
|
+
- spec/spec_helper.rb
|
180
|
+
homepage: ''
|
181
|
+
licenses: []
|
182
|
+
post_install_message:
|
183
|
+
rdoc_options: []
|
184
|
+
require_paths:
|
185
|
+
- lib
|
186
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
192
|
+
- 0
|
193
|
+
hash: 2485592278397945638
|
194
|
+
none: false
|
195
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
segments:
|
201
|
+
- 0
|
202
|
+
hash: 2485592278397945638
|
203
|
+
none: false
|
204
|
+
requirements: []
|
205
|
+
rubyforge_project:
|
206
|
+
rubygems_version: 1.8.24
|
207
|
+
signing_key:
|
208
|
+
specification_version: 3
|
209
|
+
summary: PSN allows you to interact with the Playstation Network.
|
210
|
+
test_files:
|
211
|
+
- spec/cassettes/PSN_API/fetches_games_for_an_user.yml
|
212
|
+
- spec/cassettes/PSN_API/fetches_player_summaries_for_an_user.yml
|
213
|
+
- spec/cassettes/PSN_Game/finds_the_correct_id.yml
|
214
|
+
- spec/cassettes/PSN_Game/finds_the_correct_name.yml
|
215
|
+
- spec/cassettes/PSN_GamesList/creates_game_objects.yml
|
216
|
+
- spec/cassettes/PSN_GamesList/has_the_right_amount_of_games.yml
|
217
|
+
- spec/cassettes/PSN_User/avatar/has_an_avatar.yml
|
218
|
+
- spec/cassettes/PSN_User/games/fetches_the_right_amount_of_games.yml
|
219
|
+
- spec/psn/api_spec.rb
|
220
|
+
- spec/psn/game_spec.rb
|
221
|
+
- spec/psn/games_list_spec.rb
|
222
|
+
- spec/psn/user_spec.rb
|
223
|
+
- spec/spec_helper.rb
|