bnet 0.0.5 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/TODO.md +18 -17
- data/fixtures/cassettes/WoW_Alexeistukov_Appearance.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Audit.yml +47 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Feed.yml +167 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Guild.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Hunter_Pets.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Items.yml +64 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Mounts.yml +55 -0
- data/fixtures/cassettes/WoW_Alexeistukov_PVP.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Pet_Slots.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Pets.yml +60 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Progression.yml +152 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Stats.yml +46 -0
- data/fixtures/cassettes/WoW_Alexeistukov_Talents.yml +75 -0
- data/fixtures/cassettes/WoW_Alexeistukov_achievements.yml +46 -0
- data/fixtures/cassettes/wow_alexeistukov_Quests.yml +46 -0
- data/fixtures/cassettes/wow_alexeistukov_Reputation.yml +100 -0
- data/lib/bnet/starcraft2/ladder.rb +21 -29
- data/lib/bnet/version.rb +1 -1
- data/lib/bnet/wow.rb +26 -0
- data/lib/bnet/wow/character.rb +112 -8
- data/spec/bnet/wow/character_scope_spec.rb +123 -0
- data/spec/bnet/wow/character_spec.rb +3 -3
- metadata +20 -2
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for "memoized WoW character scope" do
|
4
|
+
it 'memoizes character scope calls' do
|
5
|
+
client = instance_double('Bnet::WOW')
|
6
|
+
expect(Bnet::WOW).to receive(:new).and_return(client).exactly(:once)
|
7
|
+
expect(client).to receive(:scoped).exactly(:once).and_return([1,2,3])
|
8
|
+
subject.send(scope)
|
9
|
+
subject.send(scope)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe Bnet::WOW::Character do
|
14
|
+
|
15
|
+
context "Alexeistukov character" do
|
16
|
+
subject(:character) { described_class.new(region: 'us', realm: 'Dragonmaw', name: 'Alexeistukov')}
|
17
|
+
|
18
|
+
describe "#achievements", vcr: {cassette_name: 'WoW Alexeistukov achievements'} do
|
19
|
+
it { expect(subject.achievements).to_not be_empty }
|
20
|
+
it_behaves_like 'memoized WoW character scope' do
|
21
|
+
let(:scope) {'achievements'}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#appearance", vcr: {cassette_name: 'WoW Alexeistukov Appearance'} do
|
26
|
+
it { expect(subject.appearance).to_not be_empty }
|
27
|
+
it_behaves_like 'memoized WoW character scope' do
|
28
|
+
let(:scope) {'appearance'}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#feed", vcr: {cassette_name: 'WoW Alexeistukov Feed'} do
|
33
|
+
it { expect(subject.feed).to_not be_empty }
|
34
|
+
it_behaves_like 'memoized WoW character scope' do
|
35
|
+
let(:scope) {'feed'}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#guild", vcr: {cassette_name: 'WoW Alexeistukov Guild'} do
|
40
|
+
it { expect(subject.guild).to_not be_empty }
|
41
|
+
it_behaves_like 'memoized WoW character scope' do
|
42
|
+
let(:scope) {'guild'}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#hunter_pets", vcr: {cassette_name: 'WoW Alexeistukov Hunter Pets'} do
|
47
|
+
it { expect(subject.hunter_pets).to be_nil }
|
48
|
+
it_behaves_like 'memoized WoW character scope' do
|
49
|
+
let(:scope) {'hunter_pets'}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#items", vcr: {cassette_name: 'WoW Alexeistukov Items'} do
|
54
|
+
it { expect(subject.items).to_not be_empty }
|
55
|
+
it_behaves_like 'memoized WoW character scope' do
|
56
|
+
let(:scope) {'items'}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#mounts", vcr: {cassette_name: 'WoW Alexeistukov Mounts'} do
|
61
|
+
it { expect(subject.mounts).to_not be_empty }
|
62
|
+
it_behaves_like 'memoized WoW character scope' do
|
63
|
+
let(:scope) {'mounts'}
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "#pets", vcr: {cassette_name: 'WoW Alexeistukov Pets'} do
|
68
|
+
it { expect(subject.pets).to_not be_empty }
|
69
|
+
it_behaves_like 'memoized WoW character scope' do
|
70
|
+
let(:scope) {'pets'}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "#pet_slots", vcr: {cassette_name: 'WoW Alexeistukov Pet Slots'} do
|
75
|
+
it { expect(subject.pet_slots).to_not be_empty }
|
76
|
+
it_behaves_like 'memoized WoW character scope' do
|
77
|
+
let(:scope) {'pet_slots'}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe "#progression", vcr: {cassette_name: 'WoW Alexeistukov Progression'} do
|
82
|
+
it { expect(subject.progression).to_not be_empty }
|
83
|
+
it_behaves_like 'memoized WoW character scope' do
|
84
|
+
let(:scope) {'progression'}
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#pvp", vcr: {cassette_name: 'WoW Alexeistukov PVP'} do
|
89
|
+
it { expect(subject.pvp).to_not be_empty }
|
90
|
+
it_behaves_like 'memoized WoW character scope' do
|
91
|
+
let(:scope) {'pvp'}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#reputation", vcr: {cassette_name: 'wow alexeistukov Reputation'} do
|
96
|
+
it { expect(subject.reputation).to_not be_empty }
|
97
|
+
it_behaves_like 'memoized WoW character scope' do
|
98
|
+
let(:scope) {'reputation'}
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "#stats", vcr: {cassette_name: 'WoW Alexeistukov Stats'} do
|
103
|
+
it { expect(subject.stats).to_not be_empty }
|
104
|
+
it_behaves_like 'memoized WoW character scope' do
|
105
|
+
let(:scope) {'stats'}
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "#talents", vcr: {cassette_name: 'WoW Alexeistukov Talents'} do
|
110
|
+
it { expect(subject.talents).to_not be_empty }
|
111
|
+
it_behaves_like 'memoized WoW character scope' do
|
112
|
+
let(:scope) {'talents'}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe "#audit", vcr: {cassette_name: 'WoW Alexeistukov Audit'} do
|
117
|
+
it { expect(subject.audit).to_not be_empty }
|
118
|
+
it_behaves_like 'memoized WoW character scope' do
|
119
|
+
let(:scope) {'audit'}
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Bnet::WOW::Character do
|
4
|
-
|
5
4
|
describe ".from_api" do
|
6
5
|
let(:attrs) {
|
7
6
|
{
|
@@ -40,14 +39,15 @@ describe Bnet::WOW::Character do
|
|
40
39
|
it "returns the instance" do
|
41
40
|
expect(subject).to be_a_kind_of(described_class)
|
42
41
|
expect(subject.name).to eq("Alexeistukov")
|
42
|
+
expect(subject.realm).to eq("Dragonmaw")
|
43
|
+
expect(subject.region).to eq("us")
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
47
|
context "specified character does not exist on the server", vcr: {cassette_name: 'wow_character_not_found'} do
|
47
48
|
let(:attrs){
|
48
49
|
{
|
49
|
-
region: 'us', name: 'NotHereYo', realm: 'Dragonmaw'
|
50
|
-
key: VCR::SECRETS["api_key"]
|
50
|
+
region: 'us', name: 'NotHereYo', realm: 'Dragonmaw'
|
51
51
|
}
|
52
52
|
}
|
53
53
|
it { is_expected.to be_nil }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Buddy Magsipoc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -216,6 +216,20 @@ files:
|
|
216
216
|
- fixtures/cassettes/SC2_Matches_for_Naniwa_Profile_found.yml
|
217
217
|
- fixtures/cassettes/SC2_Naniwa_ladder_profile_found.yml
|
218
218
|
- fixtures/cassettes/SC2_Naniwa_profile_found.yml
|
219
|
+
- fixtures/cassettes/WoW_Alexeistukov_Appearance.yml
|
220
|
+
- fixtures/cassettes/WoW_Alexeistukov_Audit.yml
|
221
|
+
- fixtures/cassettes/WoW_Alexeistukov_Feed.yml
|
222
|
+
- fixtures/cassettes/WoW_Alexeistukov_Guild.yml
|
223
|
+
- fixtures/cassettes/WoW_Alexeistukov_Hunter_Pets.yml
|
224
|
+
- fixtures/cassettes/WoW_Alexeistukov_Items.yml
|
225
|
+
- fixtures/cassettes/WoW_Alexeistukov_Mounts.yml
|
226
|
+
- fixtures/cassettes/WoW_Alexeistukov_PVP.yml
|
227
|
+
- fixtures/cassettes/WoW_Alexeistukov_Pet_Slots.yml
|
228
|
+
- fixtures/cassettes/WoW_Alexeistukov_Pets.yml
|
229
|
+
- fixtures/cassettes/WoW_Alexeistukov_Progression.yml
|
230
|
+
- fixtures/cassettes/WoW_Alexeistukov_Stats.yml
|
231
|
+
- fixtures/cassettes/WoW_Alexeistukov_Talents.yml
|
232
|
+
- fixtures/cassettes/WoW_Alexeistukov_achievements.yml
|
219
233
|
- fixtures/cassettes/diablo_hero_found.yml
|
220
234
|
- fixtures/cassettes/diablo_hero_notf_found.yml
|
221
235
|
- fixtures/cassettes/diablo_hero_reload.yml
|
@@ -223,6 +237,8 @@ files:
|
|
223
237
|
- fixtures/cassettes/find_diablo_career_player_one_.yml
|
224
238
|
- fixtures/cassettes/sc2_profile_found.yml
|
225
239
|
- fixtures/cassettes/sc2_profile_not_found.yml
|
240
|
+
- fixtures/cassettes/wow_alexeistukov_Quests.yml
|
241
|
+
- fixtures/cassettes/wow_alexeistukov_Reputation.yml
|
226
242
|
- fixtures/cassettes/wow_character_found.yml
|
227
243
|
- fixtures/cassettes/wow_character_not_found.yml
|
228
244
|
- fixtures/cassettes/wow_data_battlegroups_all.yml
|
@@ -263,6 +279,7 @@ files:
|
|
263
279
|
- spec/bnet/starcraft2/ladder_spec.rb
|
264
280
|
- spec/bnet/starcraft2/match_spec.rb
|
265
281
|
- spec/bnet/starcraft2/profile_spec.rb
|
282
|
+
- spec/bnet/wow/character_scope_spec.rb
|
266
283
|
- spec/bnet/wow/character_spec.rb
|
267
284
|
- spec/bnet/wow/data/base_spec.rb
|
268
285
|
- spec/bnet/wow/data/battlegroup_spec.rb
|
@@ -309,6 +326,7 @@ test_files:
|
|
309
326
|
- spec/bnet/starcraft2/ladder_spec.rb
|
310
327
|
- spec/bnet/starcraft2/match_spec.rb
|
311
328
|
- spec/bnet/starcraft2/profile_spec.rb
|
329
|
+
- spec/bnet/wow/character_scope_spec.rb
|
312
330
|
- spec/bnet/wow/character_spec.rb
|
313
331
|
- spec/bnet/wow/data/base_spec.rb
|
314
332
|
- spec/bnet/wow/data/battlegroup_spec.rb
|