xbl_gamercard 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "spec_helper"
3
+
4
+ describe "Gamercard" do
5
+ it "escapes gamertag with right escape style" do
6
+ url = XblGamercard::Gamercard.url_for("Major Nelson")
7
+ expect(url).to eq("http://gamercard.xbox.com/en-US/Major%20Nelson.card")
8
+ end
9
+
10
+ context "with thegoldenrecord's data", :vcr => true do
11
+ it "passes sanity checks" do
12
+ gamercard = XblGamercard::Gamercard.fetch("thegoldenrecord")
13
+ expect(gamercard.gamertag).to eq("thegoldenrecord")
14
+ expect(gamercard.gamerscore).to eq(3845)
15
+ expect(gamercard.location).to eq("")
16
+ expect(gamercard.motto).to eq("")
17
+ expect(gamercard.name).to eq("Chris")
18
+ expect(gamercard.bio).to eq("")
19
+ expect(gamercard.icon_url).to eq("http://image.xboxlive.com/global/t.584109c0/tile/0/2000e")
20
+ expect(gamercard.played_games).to have(5).items
21
+
22
+ first_game = gamercard.played_games[0]
23
+
24
+ # This silliness brought to you by... unicode!
25
+ if RUBY_VERSION < "1.9"
26
+ expect(first_game.title).to eq("F1 2011\342\204\242")
27
+ else
28
+ expect(first_game.title).to eq("F1 2011™")
29
+ end
30
+ expect(first_game.icon_url).to eq("http://tiles.xbox.com/tiles/+N/OB/1Wdsb2JhbA9ECgQLG1QfVltRL2ljb24vMC84MDAwIAAAAAAAAPqu0+c=.jpg")
31
+ expect(first_game.last_played).to eq("2/27/2014")
32
+ expect(first_game.earned_gamerscore).to eq(195)
33
+ expect(first_game.available_gamerscore).to eq(1000)
34
+ expect(first_game.earned_achievements).to eq(9)
35
+ expect(first_game.available_achievements).to eq(38)
36
+ expect(first_game.percentage_complete).to eq(23)
37
+ end
38
+ end
39
+
40
+ context "with rider2710's data", :vcr => true do
41
+ it "passes (minimal) sanity checks" do
42
+ gamercard = XblGamercard::Gamercard.fetch("rider2710")
43
+ expect(gamercard.gamertag).to eq("rider2710")
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe "LiveProfile" do
4
+ it "escapes gamertag with right escape style" do
5
+ url = XblGamercard::LiveProfile.url_for("Major Nelson")
6
+ expect(url).to eq("https://live.xbox.com/en-US/Profile?Gamertag=Major+Nelson")
7
+ end
8
+
9
+ context "with thegoldenrecord's data", :vcr => true do
10
+ it "passes sanity checks" do
11
+ gamercard = XblGamercard::LiveProfile.fetch("thegoldenrecord")
12
+ expect(gamercard.gamertag).to eq("thegoldenrecord")
13
+ expect(gamercard.gamerscore).to eq(3845)
14
+ expect(gamercard.location).to eq("")
15
+ expect(gamercard.motto).to eq("")
16
+ expect(gamercard.name).to eq("Chris")
17
+ expect(gamercard.bio).to eq("")
18
+ expect(gamercard.icon_url).to eq("https://avatar-ssl.xboxlive.com/global/t.584109c0/tile/0/2000e")
19
+
20
+ expect(gamercard.avatar_image_url).to eq("https://avatar-ssl.xboxlive.com/avatar/thegoldenrecord/avatar-body.png")
21
+ expect(gamercard.presence).to eq("Last seen 2/27/2014 playing Xbox Dashboard")
22
+ end
23
+ end
24
+
25
+ context "with rider2710's data", :vcr => true do
26
+ it "passes (minimal) sanity checks" do
27
+ gamercard = XblGamercard::LiveProfile.fetch("rider2710")
28
+ expect(gamercard.motto).to eq("Fast & Bulbous")
29
+ expect(gamercard.presence).to eq("Last seen 3/1/2014 playing Xbox One")
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ require "xbl_gamercard"
2
+ require "vcr"
3
+
4
+ VCR.configure do |c|
5
+ c.cassette_library_dir = "spec/cassettes"
6
+ c.hook_into :webmock
7
+ c.configure_rspec_metadata!
8
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xbl_gamercard/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xbl_gamercard"
8
+ spec.version = XblGamercard::VERSION
9
+ spec.authors = ["Hsiu-Fan Wang"]
10
+ spec.email = ["hfwang@porkbuns.net"]
11
+ spec.summary = %q{XBox Live gamercard and Live profile scraper}
12
+ spec.description = %q{A Nokogiri based XBox Live gamercard and Live profile scraper}
13
+ spec.homepage = "https://github.com/hfwang/xbl_gamercard"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ if RUBY_VERSION < "1.9"
22
+ spec.add_dependency "nokogiri", "~> 1.5.9"
23
+ else
24
+ spec.add_dependency "nokogiri", "~> 1.0"
25
+ end
26
+
27
+ spec.add_development_dependency "rspec", "~> 2.4"
28
+ spec.add_development_dependency "bundler", "~> 1.5"
29
+ spec.add_development_dependency "vcr", "~> 2.8"
30
+ spec.add_development_dependency "webmock", "~> 1.15.0"
31
+ spec.add_development_dependency "rake"
32
+ end
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xbl_gamercard
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hsiu-Fan Wang
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.8'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 1.15.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 1.15.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A Nokogiri based XBox Live gamercard and Live profile scraper
98
+ email:
99
+ - hfwang@porkbuns.net
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - lib/xbl_gamercard.rb
111
+ - lib/xbl_gamercard/gamercard.rb
112
+ - lib/xbl_gamercard/gamercard_game.rb
113
+ - lib/xbl_gamercard/live_profile.rb
114
+ - lib/xbl_gamercard/micro_scraper.rb
115
+ - lib/xbl_gamercard/version.rb
116
+ - spec/cassettes/Gamercard/with_rider2710_s_data/passes_minimal_sanity_checks.yml
117
+ - spec/cassettes/Gamercard/with_thegoldenrecord_s_data/passes_sanity_checks.yml
118
+ - spec/cassettes/LiveProfile/with_rider2710_s_data/passes_minimal_sanity_checks.yml
119
+ - spec/cassettes/LiveProfile/with_thegoldenrecord_s_data/passes_sanity_checks.yml
120
+ - spec/gamercard_spec.rb
121
+ - spec/live_profile_spec.rb
122
+ - spec/spec_helper.rb
123
+ - xbl_gamercard.gemspec
124
+ homepage: https://github.com/hfwang/xbl_gamercard
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.2.1
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: XBox Live gamercard and Live profile scraper
148
+ test_files:
149
+ - spec/cassettes/Gamercard/with_rider2710_s_data/passes_minimal_sanity_checks.yml
150
+ - spec/cassettes/Gamercard/with_thegoldenrecord_s_data/passes_sanity_checks.yml
151
+ - spec/cassettes/LiveProfile/with_rider2710_s_data/passes_minimal_sanity_checks.yml
152
+ - spec/cassettes/LiveProfile/with_thegoldenrecord_s_data/passes_sanity_checks.yml
153
+ - spec/gamercard_spec.rb
154
+ - spec/live_profile_spec.rb
155
+ - spec/spec_helper.rb