gw2 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/LICENSE.md +20 -0
- data/README.md +95 -0
- data/gw2.gemspec +16 -0
- data/spec/event/event_names_spec.rb +22 -0
- data/spec/event/events_spec.rb +55 -0
- data/spec/event/map_names_spec.rb +22 -0
- data/spec/event/world_names_spec.rb +22 -0
- data/spec/item/item_details_spec.rb +34 -0
- data/spec/item/items_spec.rb +22 -0
- data/spec/recipe/recipe_details_spec.rb +34 -0
- data/spec/recipe/recipes_spec.rb +22 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/wvw/match_details_spec.rb +108 -0
- data/spec/wvw/matches_spec.rb +25 -0
- data/spec/wvw/objective_names_spec.rb +25 -0
- metadata +44 -15
data/CHANGELOG.md
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Chris Rosario
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# The Guild Wars 2 API Gem
|
2
|
+
|
3
|
+
A Ruby interface for accessing the Guild Wars 2 API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install gw2
|
8
|
+
|
9
|
+
## Dynamic Event API
|
10
|
+
|
11
|
+
**Get all dynamic events**
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
GW2::Event.all
|
15
|
+
```
|
16
|
+
|
17
|
+
**Get all dynamic events from a specific world**
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
GW2::Event.where(world_id: 1013)
|
21
|
+
```
|
22
|
+
|
23
|
+
**Get all dynamic events from a specific map**
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
GW2::Event.where(map_id: 39)
|
27
|
+
```
|
28
|
+
|
29
|
+
**Get instances of a specific dynamic event**
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
GW2::Event.where(event_id: "F5D23902-2D9A-4B58-8B7D-1EEA0067134D")
|
33
|
+
```
|
34
|
+
|
35
|
+
Note: you can use any combination of world_id, map_id and event_id for querying dynamic events.
|
36
|
+
|
37
|
+
**Get all names of events, maps or worlds**
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
GW2::Event.event_names
|
41
|
+
GW2::Event.map_names
|
42
|
+
GW2::Event.world_names
|
43
|
+
```
|
44
|
+
|
45
|
+
## World vs World API
|
46
|
+
|
47
|
+
**Get all current matches**
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
GW2::WvW.matches
|
51
|
+
```
|
52
|
+
|
53
|
+
**Get details of a specific match**
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
GW2::WvW.match_details("1-5")
|
57
|
+
```
|
58
|
+
|
59
|
+
**Get all objective names**
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
GW2::WvW.objective_names
|
63
|
+
```
|
64
|
+
|
65
|
+
## Item and Recipe Database API
|
66
|
+
|
67
|
+
**Get all discovered items**
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
GW2::Item.all
|
71
|
+
```
|
72
|
+
|
73
|
+
**Get details of a specific item**
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
GW2::Item.details(38875)
|
77
|
+
```
|
78
|
+
|
79
|
+
**Get all discovered recipes**
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
GW2::Recipe.all
|
83
|
+
```
|
84
|
+
|
85
|
+
**Get details of a specific recipe**
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
GW2::Recipe.details(1275)
|
89
|
+
```
|
90
|
+
|
91
|
+
## Copyright
|
92
|
+
Copyright (c) 2013 Chris Rosario.
|
93
|
+
See [LICENSE][] for details.
|
94
|
+
|
95
|
+
[license]: LICENSE.md
|
data/gw2.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "gw2"
|
3
|
+
s.version = "1.0.1"
|
4
|
+
s.date = "2013-05-22"
|
5
|
+
s.summary = "Guild Wars 2 API"
|
6
|
+
s.description = "A ruby gem for accessing the Guild Wars 2 API"
|
7
|
+
s.authors = ["Chris Rosario"]
|
8
|
+
s.email = "c.allen.rosario@gmail.com"
|
9
|
+
s.files = %w(LICENSE.md CHANGELOG.md README.md gw2.gemspec)
|
10
|
+
s.files += Dir.glob("lib/**/*.rb")
|
11
|
+
s.files += Dir.glob("spec/**/*")
|
12
|
+
s.homepage = "https://github.com/callenrosario/gw2"
|
13
|
+
s.licenses = ['MIT']
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
s.test_files = Dir.glob("spec/**/*")
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Event do
|
4
|
+
describe "methods" do
|
5
|
+
context "#event_names" do
|
6
|
+
before :each do
|
7
|
+
@event_names = %Q([{"id":"7C2B9506-5C0C-49CA-9C73-3EA740772944","name":"Skill Challenge: Fight the Quaggan Pirate"}])
|
8
|
+
|
9
|
+
stub_request(:get, "https://api.guildwars2.com/v1/event_names.json").
|
10
|
+
to_return(:status => 200, :body => @event_names)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exists" do
|
14
|
+
GW2::Event.respond_to?(:event_names).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the correct data" do
|
18
|
+
GW2::Event.event_names.should == JSON.parse(@event_names)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Event do
|
4
|
+
describe "methods" do
|
5
|
+
context "#all" do
|
6
|
+
before :each do
|
7
|
+
@events = [
|
8
|
+
{ "world_id" => 1013, "map_id" => 873, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537B", "state" => "Active" },
|
9
|
+
{ "world_id" => 1014, "map_id" => 874, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537C", "state" => "Success" },
|
10
|
+
{ "world_id" => 1015, "map_id" => 875, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537D", "state" => "Fail" },
|
11
|
+
{ "world_id" => 1016, "map_id" => 876, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537E", "state" => "Warmup" },
|
12
|
+
{ "world_id" => 1017, "map_id" => 877, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537F", "state" => "Preperation" }
|
13
|
+
]
|
14
|
+
|
15
|
+
stub_request(:get, "https://api.guildwars2.com/v1/events.json").
|
16
|
+
to_return(:status => 200, :body => { "events" => @events }.to_json)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "exists" do
|
20
|
+
GW2::Event.respond_to?(:all).should == true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "returns the correct JSON parsed data" do
|
24
|
+
GW2::Event.all.should == { "events" => @events }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "#events" do
|
29
|
+
before :each do
|
30
|
+
@events = [
|
31
|
+
{ "world_id" => 1013, "map_id" => 873, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537B", "state" => "Active" },
|
32
|
+
{ "world_id" => 1014, "map_id" => 874, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537C", "state" => "Success" },
|
33
|
+
{ "world_id" => 1015, "map_id" => 875, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537D", "state" => "Fail" },
|
34
|
+
{ "world_id" => 1016, "map_id" => 876, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537E", "state" => "Warmup" },
|
35
|
+
{ "world_id" => 1017, "map_id" => 877, "event_id" => "659149D4-43EC-4DCB-A6BB-0B2D402B537F", "state" => "Preperation" }
|
36
|
+
]
|
37
|
+
|
38
|
+
stub_request(:get, "https://api.guildwars2.com/v1/events.json?world_id=1014").
|
39
|
+
to_return(:status => 200, :body => { "events" => @events.select{ |n| n[:world_id] == 1014 } }.to_json)
|
40
|
+
stub_request(:get, "https://api.guildwars2.com/v1/events.json?map_id=875").
|
41
|
+
to_return(:status => 200, :body => { "events" => @events.select{ |n| n[:map_id] == 875 } }.to_json)
|
42
|
+
stub_request(:get, "https://api.guildwars2.com/v1/events.json?event_id=875").
|
43
|
+
to_return(:status => 200, :body => { "events" => @events.select{ |n| n[:event_id] == "659149D4-43EC-4DCB-A6BB-0B2D402B537E" } }.to_json)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "exists" do
|
47
|
+
GW2::Event.respond_to?(:where).should == true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "returns the correct JSON parsed data" do
|
51
|
+
GW2::Event.where(world_id: 1014).should == { "events" => @events.select{ |n| n[:world_id] == 1014 } }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Event do
|
4
|
+
describe "methods" do
|
5
|
+
context "#map_names" do
|
6
|
+
before :each do
|
7
|
+
@map_names = %Q([{"id":"15","name":"Queensdale"}])
|
8
|
+
|
9
|
+
stub_request(:get, "https://api.guildwars2.com/v1/map_names.json").
|
10
|
+
to_return(:status => 200, :body => @map_names)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exists" do
|
14
|
+
GW2::Event.respond_to?(:map_names).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the correct JSON parsed data" do
|
18
|
+
GW2::Event.map_names.should == JSON.parse(@map_names)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Event do
|
4
|
+
describe "methods" do
|
5
|
+
context "#world_names" do
|
6
|
+
before :each do
|
7
|
+
@world_names = %Q([{"id":"1004","name":"Henge of Denravi"}])
|
8
|
+
|
9
|
+
stub_request(:get, "https://api.guildwars2.com/v1/world_names.json").
|
10
|
+
to_return(:status => 200, :body => @world_names)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exists" do
|
14
|
+
GW2::Event.respond_to?(:world_names).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the correct JSON parsed data" do
|
18
|
+
GW2::Event.world_names.should == JSON.parse(@world_names)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Item do
|
4
|
+
describe "methods" do
|
5
|
+
context "#details" do
|
6
|
+
before :each do
|
7
|
+
@item_details = {
|
8
|
+
"item_id" => "12546",
|
9
|
+
"name" => "Lemongrass",
|
10
|
+
"description" => "Ingredient",
|
11
|
+
"type" => "CraftingMaterial",
|
12
|
+
"level" => "80",
|
13
|
+
"rarity" => "Basic",
|
14
|
+
"vendor_value" => "9",
|
15
|
+
"game_types" => ["Activity","Dungeon","Pve","Wvw"],
|
16
|
+
"flags" => [],
|
17
|
+
"restrictions" => [],
|
18
|
+
"crafting_material" => ""
|
19
|
+
}
|
20
|
+
|
21
|
+
stub_request(:get, "https://api.guildwars2.com/v1/item_details.json?item_id=12546").
|
22
|
+
to_return(:status => 200, :body => @item_details.to_json)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "exists" do
|
26
|
+
GW2::Item.respond_to?(:details).should == true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns the correct JSON parsed data" do
|
30
|
+
GW2::Item.details(12546).should == @item_details
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Item do
|
4
|
+
describe "methods" do
|
5
|
+
context "#all" do
|
6
|
+
before :each do
|
7
|
+
@items = [12546, 12547, 12548, 12549, 12550]
|
8
|
+
|
9
|
+
stub_request(:get, "https://api.guildwars2.com/v1/items.json").
|
10
|
+
to_return(:status => 200, :body => { "items" => @items }.to_json)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exists" do
|
14
|
+
GW2::Item.respond_to?(:all).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the correct JSON parsed data" do
|
18
|
+
GW2::Item.all.should == { "items" => @items }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Recipe do
|
4
|
+
describe "methods" do
|
5
|
+
context "#details" do
|
6
|
+
before :each do
|
7
|
+
@recipe_details = {
|
8
|
+
"recipe_id" => "1275",
|
9
|
+
"type" => "Coat",
|
10
|
+
"output_item_id" => "11541",
|
11
|
+
"output_item_count" => "1",
|
12
|
+
"min_rating" => "25",
|
13
|
+
"time_to_craft_ms" => "1000",
|
14
|
+
"ingredients" => [
|
15
|
+
{"item_id" => "19797","count" => "1"},
|
16
|
+
{"item_id" => "13094","count" => "1"},
|
17
|
+
{"item_id" => "13093","count" => "1"}
|
18
|
+
]
|
19
|
+
}
|
20
|
+
|
21
|
+
stub_request(:get, "https://api.guildwars2.com/v1/recipe_details.json?recipe_id=1275").
|
22
|
+
to_return(:status => 200, :body => @recipe_details.to_json)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "exists" do
|
26
|
+
GW2::Recipe.respond_to?(:details).should == true
|
27
|
+
end
|
28
|
+
|
29
|
+
it "returns the correct JSON parsed data" do
|
30
|
+
GW2::Recipe.details(1275).should == @recipe_details
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::Recipe do
|
4
|
+
describe "methods" do
|
5
|
+
context "#all" do
|
6
|
+
before :each do
|
7
|
+
@recipes = [1275, 1276, 1277, 1278, 1279]
|
8
|
+
|
9
|
+
stub_request(:get, "https://api.guildwars2.com/v1/recipes.json").
|
10
|
+
to_return(:status => 200, :body => { "recipes" => @recipes }.to_json)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "exists" do
|
14
|
+
GW2::Recipe.respond_to?(:all).should == true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns the correct JSON parsed data" do
|
18
|
+
GW2::Recipe.all.should == { "recipes" => @recipes }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "webmock/rspec"
|
3
|
+
require "gw2"
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# ## Mock Framework
|
7
|
+
#
|
8
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
9
|
+
#
|
10
|
+
# config.mock_with :mocha
|
11
|
+
# config.mock_with :flexmock
|
12
|
+
# config.mock_with :rr
|
13
|
+
|
14
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
15
|
+
# examples within a transaction, remove the following line or assign false
|
16
|
+
# instead of true.
|
17
|
+
# config.use_transactional_fixtures = false
|
18
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::WvW do
|
4
|
+
describe "methods" do
|
5
|
+
context "#match_details" do
|
6
|
+
before :each do
|
7
|
+
@match_details = {
|
8
|
+
"match_id" => "2-3",
|
9
|
+
"scores" => [155221,151605,162092],
|
10
|
+
"maps" => [
|
11
|
+
{ "type" => "RedHome",
|
12
|
+
"scores" => [59573,23796,18316],
|
13
|
+
"objectives" => [
|
14
|
+
{"id" => 32,"owner" => "Blue"},
|
15
|
+
{"id" => 33,"owner" => "Blue"},
|
16
|
+
{"id" => 34,"owner" => "Blue"},
|
17
|
+
{"id" => 35,"owner" => "Blue"},
|
18
|
+
{"id" => 36,"owner" => "Blue"},
|
19
|
+
{"id" => 37,"owner" => "Blue","owner_guild" => "199C1F0E-AD62-4FF4-BE56-1189FFB8A89A"},
|
20
|
+
{"id" => 38,"owner" => "Red"},
|
21
|
+
{"id" => 39,"owner" => "Blue"},
|
22
|
+
{"id" => 40,"owner" => "Blue"},
|
23
|
+
{"id" => 50,"owner" => "Blue","owner_guild" => "E5E16465-4CB5-494A-8990-B893C46B527E"},
|
24
|
+
{"id" => 51,"owner" => "Blue"},
|
25
|
+
{"id" => 52,"owner" => "Red"},
|
26
|
+
{"id" => 53,"owner" => "Blue"}
|
27
|
+
]
|
28
|
+
},
|
29
|
+
{ "type" => "GreenHome",
|
30
|
+
"scores" => [20680,26330,52579],
|
31
|
+
"objectives" => [
|
32
|
+
{"id" => 41,"owner" => "Blue"},
|
33
|
+
{"id" => 42,"owner" => "Blue"},
|
34
|
+
{"id" => 43,"owner" => "Blue"},
|
35
|
+
{"id" => 44,"owner" => "Blue","owner_guild" => "6E884D81-3E34-46EE-85A1-91BE902D5522"},
|
36
|
+
{"id" => 45,"owner" => "Blue","owner_guild" => "ABBD0F2A-DD9F-4496-9AD2-CFBB9958DA11"},
|
37
|
+
{"id" => 46,"owner" => "Blue","owner_guild" => "3BADBA61-A0FC-47A8-8558-26591049C9CD"},
|
38
|
+
{"id" => 47,"owner" => "Green","owner_guild" => "7FE25AEC-96B8-46A9-88B1-9B99ABF42F40"},
|
39
|
+
{"id" => 48,"owner" => "Blue"},
|
40
|
+
{"id" => 49,"owner" => "Blue","owner_guild" => "F7BE2E79-87F6-441A-96AC-F66075668102"},
|
41
|
+
{"id" => 54,"owner" => "Red"},
|
42
|
+
{"id" => 55,"owner" => "Red"},
|
43
|
+
{"id" => 56,"owner" => "Blue"},
|
44
|
+
{"id" => 57,"owner" => "Blue"}
|
45
|
+
]
|
46
|
+
},
|
47
|
+
{ "type" => "BlueHome",
|
48
|
+
"scores" => [27092,55872,17878],
|
49
|
+
"objectives" => [
|
50
|
+
{"id" => 23,"owner" => "Blue"},
|
51
|
+
{"id" => 24,"owner" => "Red"},
|
52
|
+
{"id" => 25,"owner" => "Blue"},
|
53
|
+
{"id" => 26,"owner" => "Blue"},
|
54
|
+
{"id" => 27,"owner" => "Blue"},
|
55
|
+
{"id" => 28,"owner" => "Blue"},
|
56
|
+
{"id" => 29,"owner" => "Blue","owner_guild" => "AEA6CFB4-9378-4548-831E-01110EFB1619"},
|
57
|
+
{"id" => 30,"owner" => "Blue"},
|
58
|
+
{"id" => 31,"owner" => "Blue"},
|
59
|
+
{"id" => 58,"owner" => "Blue"},
|
60
|
+
{"id" => 59,"owner" => "Blue"},
|
61
|
+
{"id" => 60,"owner" => "Red"},
|
62
|
+
{"id" => 61,"owner" => "Red"}
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{ "type" => "Center",
|
66
|
+
"scores" => [47876,45607,73319],
|
67
|
+
"objectives" => [
|
68
|
+
{"id" => 1,"owner" => "Red","owner_guild" => "0E59E334-5F87-46A5-8CC8-6953AE5FC16A"},
|
69
|
+
{"id" => 2,"owner" => "Blue","owner_guild" => "F36CC3FE-4F8B-486B-B5E1-D725119505F8"},
|
70
|
+
{"id" => 3,"owner" => "Green","owner_guild" => "634BB549-B013-44BF-8915-2075DCA94062"},
|
71
|
+
{"id" => 4,"owner" => "Green"},
|
72
|
+
{"id" => 5,"owner" => "Blue"},
|
73
|
+
{"id" => 6,"owner" => "Red"},
|
74
|
+
{"id" => 7,"owner" => "Green","owner_guild" => "CF02A8AE-EC30-4377-9897-CC8EEC12050B"},
|
75
|
+
{"id" => 8,"owner" => "Blue"},
|
76
|
+
{"id" => 9,"owner" => "Blue","owner_guild" => "61B7040B-C243-4BB5-934C-C60AF0AD9FAE"},
|
77
|
+
{"id" => 10,"owner" => "Green"},
|
78
|
+
{"id" => 11,"owner" => "Green","owner_guild" => "390ABFA1-BB45-47F1-BBF9-EA4213FD8F76"},
|
79
|
+
{"id" => 12,"owner" => "Green","owner_guild" => "C4D66309-DB0B-4CE1-A97E-B0C587C65994"},
|
80
|
+
{"id" => 13,"owner" => "Green","owner_guild" => "71F44932-2DAA-4406-A705-AC4C557E57D1"},
|
81
|
+
{"id" => 14,"owner" => "Green","owner_guild" => "D4BDDB21-CCB4-4838-94B8-170457AAB623"},
|
82
|
+
{"id" => 15,"owner" => "Blue","owner_guild" => "7847823D-FB01-43FF-A7C2-DC0F0D12D4E7"},
|
83
|
+
{"id" => 16,"owner" => "Blue","owner_guild" => "D12DB7AD-01FD-41F2-AE08-19A92AA05F6D"},
|
84
|
+
{"id" => 17,"owner" => "Red"},
|
85
|
+
{"id" => 18,"owner" => "Blue"},
|
86
|
+
{"id" => 19,"owner" => "Red","owner_guild" => "EDA9DED3-8FA9-4B29-8787-06ED031238AA"},
|
87
|
+
{"id" => 20,"owner" => "Red","owner_guild" => "75DC0FD9-7134-41E5-BBDA-6E620DF364B2"},
|
88
|
+
{"id" => 21,"owner" => "Blue"},
|
89
|
+
{"id" => 22,"owner" => "Blue","owner_guild" => "77A3A76E-A852-45FE-BA23-3A1F7847E8AC"}
|
90
|
+
]
|
91
|
+
}
|
92
|
+
]
|
93
|
+
}
|
94
|
+
|
95
|
+
stub_request(:get, "https://api.guildwars2.com/v1/wvw/match_details.json?match_id=2-3").
|
96
|
+
to_return(:status => 200, :body => @match_details.to_json)
|
97
|
+
end
|
98
|
+
|
99
|
+
it "exists" do
|
100
|
+
GW2::WvW.respond_to?(:match_details).should == true
|
101
|
+
end
|
102
|
+
|
103
|
+
it "returns the correct JSON parsed data" do
|
104
|
+
GW2::WvW.match_details("2-3").should == @match_details
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::WvW do
|
4
|
+
describe "methods" do
|
5
|
+
context "#matches" do
|
6
|
+
before :each do
|
7
|
+
@matches = [
|
8
|
+
{ "wvw_match_id" => "2-3", "red_world_id" => 2103, "blue_world_id" => 2301, "green_world_id" => 2012 },
|
9
|
+
{ "wvw_match_id" => "2-2", "red_world_id" => 2201, "blue_world_id" => 2010, "green_world_id" => 2101 }
|
10
|
+
]
|
11
|
+
|
12
|
+
stub_request(:get, "https://api.guildwars2.com/v1/wvw/matches.json").
|
13
|
+
to_return(:status => 200, :body => { "wvw_matches" => @matches }.to_json)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "exists" do
|
17
|
+
GW2::WvW.respond_to?(:matches).should == true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns the correct JSON parsed data" do
|
21
|
+
GW2::WvW.matches.should == { "wvw_matches" => @matches }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GW2::WvW do
|
4
|
+
describe "methods" do
|
5
|
+
context "#objective_names" do
|
6
|
+
before :each do
|
7
|
+
@objective_names = [
|
8
|
+
{"id" => "30","name" => "Tower"},
|
9
|
+
{"id" => "57","name" => "Tower"}
|
10
|
+
]
|
11
|
+
|
12
|
+
stub_request(:get, "https://api.guildwars2.com/v1/wvw/objective_names.json").
|
13
|
+
to_return(:status => 200, :body => @objective_names.to_json)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "exists" do
|
17
|
+
GW2::WvW.respond_to?(:objective_names).should == true
|
18
|
+
end
|
19
|
+
|
20
|
+
it "returns the correct data" do
|
21
|
+
GW2::WvW.objective_names.should == @objective_names
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gw2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,24 +17,41 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
-
|
21
|
-
-
|
22
|
-
-
|
20
|
+
- LICENSE.md
|
21
|
+
- CHANGELOG.md
|
22
|
+
- README.md
|
23
|
+
- gw2.gemspec
|
23
24
|
- lib/gw2/event/event_names.rb
|
25
|
+
- lib/gw2/event/events.rb
|
24
26
|
- lib/gw2/event/map_names.rb
|
25
27
|
- lib/gw2/event/world_names.rb
|
26
|
-
- lib/gw2/
|
27
|
-
- lib/gw2/wvw/matches.rb
|
28
|
-
- lib/gw2/wvw/match_details.rb
|
29
|
-
- lib/gw2/wvw/objective_names.rb
|
30
|
-
- lib/gw2/item.rb
|
31
|
-
- lib/gw2/item/items.rb
|
28
|
+
- lib/gw2/event.rb
|
32
29
|
- lib/gw2/item/item_details.rb
|
33
|
-
- lib/gw2/
|
34
|
-
- lib/gw2/
|
30
|
+
- lib/gw2/item/items.rb
|
31
|
+
- lib/gw2/item.rb
|
35
32
|
- lib/gw2/recipe/recipe_details.rb
|
36
|
-
|
37
|
-
|
33
|
+
- lib/gw2/recipe/recipes.rb
|
34
|
+
- lib/gw2/recipe.rb
|
35
|
+
- lib/gw2/wvw/match_details.rb
|
36
|
+
- lib/gw2/wvw/matches.rb
|
37
|
+
- lib/gw2/wvw/objective_names.rb
|
38
|
+
- lib/gw2/wvw.rb
|
39
|
+
- lib/gw2.rb
|
40
|
+
- spec/event/event_names_spec.rb
|
41
|
+
- spec/event/events_spec.rb
|
42
|
+
- spec/event/map_names_spec.rb
|
43
|
+
- spec/event/world_names_spec.rb
|
44
|
+
- spec/item/item_details_spec.rb
|
45
|
+
- spec/item/items_spec.rb
|
46
|
+
- spec/recipe/recipe_details_spec.rb
|
47
|
+
- spec/recipe/recipes_spec.rb
|
48
|
+
- spec/spec_helper.rb
|
49
|
+
- spec/wvw/match_details_spec.rb
|
50
|
+
- spec/wvw/matches_spec.rb
|
51
|
+
- spec/wvw/objective_names_spec.rb
|
52
|
+
homepage: https://github.com/callenrosario/gw2
|
53
|
+
licenses:
|
54
|
+
- MIT
|
38
55
|
post_install_message:
|
39
56
|
rdoc_options: []
|
40
57
|
require_paths:
|
@@ -57,4 +74,16 @@ rubygems_version: 1.8.23
|
|
57
74
|
signing_key:
|
58
75
|
specification_version: 3
|
59
76
|
summary: Guild Wars 2 API
|
60
|
-
test_files:
|
77
|
+
test_files:
|
78
|
+
- spec/event/event_names_spec.rb
|
79
|
+
- spec/event/events_spec.rb
|
80
|
+
- spec/event/map_names_spec.rb
|
81
|
+
- spec/event/world_names_spec.rb
|
82
|
+
- spec/item/item_details_spec.rb
|
83
|
+
- spec/item/items_spec.rb
|
84
|
+
- spec/recipe/recipe_details_spec.rb
|
85
|
+
- spec/recipe/recipes_spec.rb
|
86
|
+
- spec/spec_helper.rb
|
87
|
+
- spec/wvw/match_details_spec.rb
|
88
|
+
- spec/wvw/matches_spec.rb
|
89
|
+
- spec/wvw/objective_names_spec.rb
|