gamertag 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://api.xboxleaders.com:80/v2/?gamertag=Belial1984&format=json
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ date:
14
+ - Wed, 24 Aug 2011 16:40:13 GMT
15
+ server:
16
+ - Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.13
17
+ x-powered-by:
18
+ - PHP/5.2.13
19
+ expires:
20
+ - Mon, 26 Jul 1997 05:00:00 GMT
21
+ last-modified:
22
+ - Wed, 24 Aug 2011 16:40:14GMT
23
+ cache-control:
24
+ - no-cache, must-revalidate
25
+ pragma:
26
+ - no-cache
27
+ content-length:
28
+ - "3225"
29
+ content-type:
30
+ - application/json
31
+ body: "{\"user\":{\"gamertag\":\"belial1984\",\"is_valid\":1,\"profile_link\":\"http:\\/\\/live.xbox.com\\/member\\/belial1984\",\"launch_team\":{\"xbl\":0,\"nxe\":0,\"kinect\":0},\"account_status\":\"Gold\",\"gender\":\"Male\",\"is_cheater\":0,\"online\":0,\"online_status\":\"Last seen 8\\/22\\/2011 playing Modern Warfare® 2\",\"avatars\":{\"gamer_tile\":\"http:\\/\\/avatar.xboxlive.com\\/avatar\\/belial1984\\/avatarpic-l.png\",\"small_gamerpic\":\"http:\\/\\/avatar.xboxlive.com\\/avatar\\/belial1984\\/avatarpic-s.png\",\"large_gamerpic\":\"http:\\/\\/avatar.xboxlive.com\\/avatar\\/belial1984\\/avatarpic-l.png\",\"body_gamerpic\":\"http:\\/\\/avatar.xboxlive.com\\/avatar\\/belial1984\\/avatar-body.png\"},\"reputation\":100,\"gamerscore\":11910,\"location\":\"london\",\"motto\":\"\",\"name\":\"baris balic\",\"bio\":\"\",\"recent_games\":{\"1\":{\"title\":\"Modern Warfare® 2\",\"tid\":1096157207,\"marketplace_url\":\"http:\\/\\/marketplace.xbox.com\\/Title\\/1096157207\",\"compare_url\":\"http:\\/\\/live.xbox.com\\/en-US\\/GameCenter\\/Achievements?title=1096157207&compareTo=belial1984\",\"image\":\"http:\\/\\/tiles.xbox.com\\/tiles\\/l6\\/Vi\\/0Gdsb2JhbA9ECgQJGgYfVl5UL2ljb24vMC84MDAwIAAAAAAAAP9NpYg=.jpg\",\"last_played\":\"1313967600\",\"earned_gamerscore\":930,\"available_gamerscore\":1000,\"earned_achievements\":43,\"available_achievements\":50,\"percentage_complete\":86},\"2\":{\"title\":\"Halo: Reach\",\"tid\":1297287259,\"marketplace_url\":\"http:\\/\\/marketplace.xbox.com\\/Title\\/1297287259\",\"compare_url\":\"http:\\/\\/live.xbox.com\\/en-US\\/GameCenter\\/Achievements?title=1297287259&compareTo=belial1984\",\"image\":\"http:\\/\\/tiles.xbox.com\\/tiles\\/ih\\/ew\\/0Wdsb2JhbA9ECgR8GgMfVlohL2ljb24vMC84MDAwIAAAAAAAAP6fF5U=.jpg\",\"last_played\":\"1299542400\",\"earned_gamerscore\":375,\"available_gamerscore\":1400,\"earned_achievements\":26,\"available_achievements\":59,\"percentage_complete\":44},\"3\":{\"title\":\"Portal 2\",\"tid\":1161890066,\"marketplace_url\":\"http:\\/\\/marketplace.xbox.com\\/Title\\/1161890066\",\"compare_url\":\"http:\\/\\/live.xbox.com\\/en-US\\/GameCenter\\/Achievements?title=1161890066&compareTo=belial1984\",\"image\":\"http:\\/\\/tiles.xbox.com\\/tiles\\/x2\\/5+\\/1mdsb2JhbA9ECgQNGwEfV15RL2ljb24vMC84MDAwIAAAAAAAAPlRbtg=.jpg\",\"last_played\":\"\",\"earned_gamerscore\":345,\"available_gamerscore\":1000,\"earned_achievements\":21,\"available_achievements\":50,\"percentage_complete\":42},\"4\":{\"title\":\"SUPER STREETFIGHTER IV\",\"tid\":1128466428,\"marketplace_url\":\"http:\\/\\/marketplace.xbox.com\\/Title\\/1128466428\",\"compare_url\":\"http:\\/\\/live.xbox.com\\/en-US\\/GameCenter\\/Achievements?title=1128466428&compareTo=belial1984\",\"image\":\"http:\\/\\/tiles.xbox.com\\/tiles\\/oX\\/8i\\/0Wdsb2JhbA9ECgQLGwMfWSkgL2ljb24vMC84MDAwIAAAAAAAAP4Nf74=.jpg\",\"last_played\":\"1309906800\",\"earned_gamerscore\":470,\"available_gamerscore\":1160,\"earned_achievements\":28,\"available_achievements\":58,\"percentage_complete\":48},\"5\":{\"title\":\"Child of Eden\",\"tid\":1431504972,\"marketplace_url\":\"http:\\/\\/marketplace.xbox.com\\/Title\\/1431504972\",\"compare_url\":\"http:\\/\\/live.xbox.com\\/en-US\\/GameCenter\\/Achievements?title=1431504972&compareTo=belial1984\",\"image\":\"http:\\/\\/tiles.xbox.com\\/tiles\\/z2\\/Jl\\/1mdsb2JhbA9ECgUNGgMfVlsgL2ljb24vMC84MDAwIAAAAAAAAPlKYtA=.jpg\",\"last_played\":\"\",\"earned_gamerscore\":0,\"available_gamerscore\":1000,\"earned_achievements\":0,\"available_achievements\":49,\"percentage_complete\":0}}}}"
32
+ http_version: "1.1"
@@ -1,14 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Gamertag::PlayedGames do
4
+ use_vcr_cassette('PlayedGames_Belial1984')
4
5
 
5
- before(:each) do
6
- end
7
-
8
- it "should return played games" do
6
+ it "should return played games" do
9
7
  played_games = Gamertag::PlayedGames.new('Belial1984')
10
- played_games.first.title.should eql("The Orange Box")
11
- played_games.count.should == 85
8
+
9
+ played_games.first.title.should include("Modern Warfare")
10
+ played_games.count.should == 88
12
11
  played_games.each {|game| game.title.nil?.should be_false}
12
+ gamerscore_values = [:above_average, :below_average, :undefined]
13
+ played_games.each do |game|
14
+ gamerscore_values.should.include?(game.relative_gamerscore)
15
+ end
13
16
  end
14
17
  end
@@ -1,12 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Gamertag::Profile do
4
- it "should return composite details" do
4
+ use_vcr_cassette('SimpleProfile_Belial1984')
5
+ use_vcr_cassette('PlayedGames_Belial1984')
6
+
7
+ it "should return composite details" do
5
8
  profile = Gamertag::Profile.new('Belial1984')
6
9
 
7
10
  profile.gamertag.should eql('belial1984')
8
- profile.online_status.include?('SUPER STREETFIGHTER IV').should eql(true)
11
+ profile.online_status.include?('SUPER STREETFIGHTER IV').should eql(false)
9
12
  profile.recent_games.count.should eql(5)
10
- profile.played_games.count.should eql(84)
13
+ profile.played_games.count.should eql(88)
11
14
  end
12
15
  end
@@ -1,19 +1,61 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Gamertag::SimpleProfile, "#fetch" do
4
- it "should return profile data" do
5
- profile = Gamertag::SimpleProfile.new('Belial1984')
6
- profile.name.should =~ /baris balic/i
7
- profile.gamertag.should =~ /Belial1984/i
8
- profile.avatars.count.should eql(3)
9
- profile.avatars.small_gamerpic.should == 'http://avatar.xboxlive.com/avatar/belial1984/avatarpic-s.png'
3
+ describe Gamertag::SimpleProfile do
4
+ describe "#fetch" do
5
+ use_vcr_cassette('SimpleProfile_Belial1984')
6
+
7
+ it "should return profile data" do
8
+ profile = Gamertag::SimpleProfile.new('Belial1984')
9
+
10
+ profile.name.should =~ /baris balic/i
11
+ profile.gamertag.should =~ /Belial1984/i
12
+ profile.avatars.count.should eql(4)
13
+ profile.avatars.small_gamerpic.should == 'http://avatar.xboxlive.com/avatar/belial1984/avatarpic-s.png'
14
+ end
15
+
16
+ it "should return the recent games data" do
17
+ profile = Gamertag::SimpleProfile.new('Belial1984')
18
+
19
+ profile.recent_games.count.should eql(5)
20
+ profile.recent_games.first.title.should eql('Modern Warfare® 2')
21
+ profile.recent_games.first.available_gamerscore.should eql(1000)
22
+ profile.recent_games.first.last_played.class.should == Time
23
+ end
10
24
  end
11
25
 
12
- it "should return the recent games data" do
13
- profile = Gamertag::SimpleProfile.new('Belial1984')
14
- profile.recent_games.count.should eql(5)
15
- profile.recent_games.first.title.should eql('SUPER STREETFIGHTER IV')
16
- profile.recent_games.first.available_gamerscore.should eql(1000)
17
- profile.recent_games.first.last_played.class.should == Time
26
+ describe ".from_json" do
27
+ let(:seed_data) {
28
+ {
29
+ "gamertag" => "laikal1",
30
+ "is_valid" => 1,
31
+ "profile_link"=>"http://live.xbox.com/member/laikal1",
32
+ "launch_team"=>{"xbl"=>0, "nxe"=>0, "kinect"=>0},
33
+ "account_status"=>"Gold",
34
+ "gender"=>"Male",
35
+ "is_cheater"=>0,
36
+ "online"=>0,
37
+ "online_status"=>"Last seen 9 hours ago playing Xbox.com",
38
+ "avatars"=>{
39
+ "gamer_tile"=>"http://avatar.xboxlive.com/avatar/laikal1/avatarpic-l.png",
40
+ "small_gamerpic"=>"http://avatar.xboxlive.com/avatar/laikal1/avatarpic-s.png",
41
+ "large_gamerpic"=>"http://avatar.xboxlive.com/avatar/laikal1/avatarpic-l.png",
42
+ "body_gamerpic"=>"http://avatar.xboxlive.com/avatar/laikal1/avatar-body.png"
43
+ },
44
+ "reputation"=>85,
45
+ "gamerscore"=>41646,
46
+ "location"=>"Ann Arbor, MI",
47
+ "motto"=>"Complexify!",
48
+ "name"=>"Nyarlathotep (1 bucket)",
49
+ "bio"=>"Design is how it works."
50
+ }
51
+ }
52
+ it "should initialize a profile from json data without calling a remote service" do
53
+ Net::HTTP.should_not_receive(:get_response)
54
+ profile = Gamertag::SimpleProfile.from_json(seed_data.to_json)
55
+ seed_data.keys.each do |k|
56
+ profile.send(k).should == seed_data[k]
57
+ end
58
+ end
18
59
  end
60
+
19
61
  end
@@ -1,4 +1,15 @@
1
1
  require 'rubygems'
2
2
  require 'rspec'
3
+ require 'vcr'
3
4
 
4
5
  require File.join(File.dirname(__FILE__), %w{ .. lib gamertag})
6
+
7
+ VCR.config do |c|
8
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
9
+ c.stub_with :fakeweb
10
+ c.default_cassette_options = { :record => :once }
11
+ end
12
+
13
+ RSpec.configure do |c|
14
+ c.extend VCR::RSpec::Macros
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gamertag do
4
+ it "should be the correct version" do
5
+ Gamertag::VERSION.should == '1.0.1'
6
+ end
7
+ end
metadata CHANGED
@@ -1,30 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gamertag
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
4
5
  prerelease:
5
- version: 1.0.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Baris Balic
9
+ - David Czarnecki
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
-
13
- date: 2011-05-25 00:00:00 +01:00
14
- default_executable:
15
- dependencies: []
16
-
17
- description: A gem for retrieving your xbox live gamertag info
18
- email:
13
+ date: 2011-08-30 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: json
17
+ requirement: &70160132676120 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.5.3
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70160132676120
26
+ - !ruby/object:Gem::Dependency
27
+ name: hashie
28
+ requirement: &70160132675620 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *70160132675620
37
+ - !ruby/object:Gem::Dependency
38
+ name: nokogiri
39
+ requirement: &70160132675160 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.5.0
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70160132675160
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: &70160132674780 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: *70160132674780
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ requirement: &70160132674240 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ~>
65
+ - !ruby/object:Gem::Version
66
+ version: 2.6.0
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *70160132674240
70
+ - !ruby/object:Gem::Dependency
71
+ name: vcr
72
+ requirement: &70160132673740 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.11.1
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *70160132673740
81
+ - !ruby/object:Gem::Dependency
82
+ name: fakeweb
83
+ requirement: &70160132673280 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - =
87
+ - !ruby/object:Gem::Version
88
+ version: 1.3.0
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *70160132673280
92
+ description: A gem for retrieving your XBOX Live gamertag information
93
+ email:
19
94
  - baris@webloch.co.uk
95
+ - dczarnecki@agoragames.com
20
96
  executables: []
21
-
22
97
  extensions: []
23
-
24
98
  extra_rdoc_files: []
25
-
26
- files:
99
+ files:
100
+ - .gitignore
101
+ - .rvmrc
102
+ - CHANGELOG.md
27
103
  - Gemfile
104
+ - LICENSE
28
105
  - README.mdown
29
106
  - Rakefile
30
107
  - gamertag.gemspec
@@ -33,40 +110,42 @@ files:
33
110
  - lib/gamertag/profile.rb
34
111
  - lib/gamertag/simple_profile.rb
35
112
  - lib/gamertag/version.rb
113
+ - spec/fixtures/vcr_cassettes/PlayedGames_Belial1984.yml
114
+ - spec/fixtures/vcr_cassettes/SimpleProfile_Belial1984.yml
36
115
  - spec/played_games_spec.rb
37
116
  - spec/profile_spec.rb
38
117
  - spec/simple_profile_spec.rb
39
118
  - spec/spec_helper.rb
40
- has_rdoc: true
41
- homepage: ""
119
+ - spec/version_spec.rb
120
+ homepage: https://github.com/barisbalic/gamertag
42
121
  licenses: []
43
-
44
122
  post_install_message:
45
123
  rdoc_options: []
46
-
47
- require_paths:
124
+ require_paths:
48
125
  - lib
49
- required_ruby_version: !ruby/object:Gem::Requirement
126
+ required_ruby_version: !ruby/object:Gem::Requirement
50
127
  none: false
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: "0"
55
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
133
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: "0"
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
61
138
  requirements: []
62
-
63
139
  rubyforge_project: gamertag
64
- rubygems_version: 1.6.2
140
+ rubygems_version: 1.8.6
65
141
  signing_key:
66
142
  specification_version: 3
67
- summary: A gem for retrieving your xbox live gamertag info
68
- test_files:
143
+ summary: A gem for retrieving your XBOX Live gamertag information
144
+ test_files:
145
+ - spec/fixtures/vcr_cassettes/PlayedGames_Belial1984.yml
146
+ - spec/fixtures/vcr_cassettes/SimpleProfile_Belial1984.yml
69
147
  - spec/played_games_spec.rb
70
148
  - spec/profile_spec.rb
71
149
  - spec/simple_profile_spec.rb
72
150
  - spec/spec_helper.rb
151
+ - spec/version_spec.rb