gw2 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +1 -1
  3. data/README.md +4 -1
  4. data/gw2.gemspec +2 -2
  5. data/lib/gw2.rb +1 -0
  6. data/lib/gw2/disabled.rb +4 -0
  7. data/lib/gw2/event.rb +20 -5
  8. data/lib/gw2/guild.rb +4 -2
  9. data/lib/gw2/item.rb +8 -3
  10. data/lib/gw2/map.rb +18 -4
  11. data/lib/gw2/misc.rb +12 -4
  12. data/lib/gw2/recipe.rb +8 -3
  13. data/lib/gw2/wvw.rb +12 -4
  14. data/spec/fixtures/GW2_Event/_event_names/returns_the_names_of_all_events.yml +2060 -0
  15. data/spec/fixtures/GW2_Event/_map_names/returns_the_names_of_all_maps.yml +53 -0
  16. data/spec/fixtures/GW2_Event/_world_names/returns_the_names_of_all_worlds.yml +60 -0
  17. data/spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_id.yml +40 -0
  18. data/spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_name.yml +40 -0
  19. data/spec/fixtures/GW2_Item/_all/returns_all_items.yml +40 -0
  20. data/spec/fixtures/GW2_Item/_details/returns_the_details_of_the_item.yml +40 -0
  21. data/spec/fixtures/GW2_Map/_all/returns_all_maps.yml +1107 -0
  22. data/spec/fixtures/GW2_Map/_continents/returns_all_continents.yml +40 -0
  23. data/spec/fixtures/GW2_Map/_map_floor/returns_a_specific_map_floor.yml +3441 -0
  24. data/spec/fixtures/GW2_Map/_maps/returns_the_map_by_id.yml +41 -0
  25. data/spec/fixtures/GW2_Misc/_build/returns_the_build.yml +40 -0
  26. data/spec/fixtures/GW2_Misc/_colors/returns_all_colors.yml +239 -0
  27. data/spec/fixtures/GW2_Misc/_files/returns_all_files.yml +40 -0
  28. data/spec/fixtures/GW2_Recipe/_all/returns_all_recipes.yml +40 -0
  29. data/spec/fixtures/GW2_Recipe/_details/returns_the_details_of_a_recipe_by_id.yml +40 -0
  30. data/spec/fixtures/GW2_WvW/_match_details/returns_the_details_of_a_match.yml +40 -0
  31. data/spec/fixtures/GW2_WvW/_matches/returns_all_matches.yml +40 -0
  32. data/spec/fixtures/GW2_WvW/_objective_names/returns_all_objectives.yml +59 -0
  33. data/spec/gw2/event_spec.rb +66 -0
  34. data/spec/gw2/guild_spec.rb +33 -0
  35. data/spec/gw2/item_spec.rb +44 -0
  36. data/spec/gw2/map_spec.rb +102 -0
  37. data/spec/gw2/misc_spec.rb +72 -0
  38. data/spec/gw2/recipe_spec.rb +45 -0
  39. data/spec/gw2/wvw_spec.rb +55 -0
  40. data/spec/spec_helper.rb +10 -0
  41. metadata +62 -65
  42. data/lib/gw2/event/event_names.rb +0 -7
  43. data/lib/gw2/event/events.rb +0 -11
  44. data/lib/gw2/event/map_names.rb +0 -7
  45. data/lib/gw2/event/world_names.rb +0 -7
  46. data/lib/gw2/guild/guild_details.rb +0 -7
  47. data/lib/gw2/item/item_details.rb +0 -7
  48. data/lib/gw2/item/items.rb +0 -7
  49. data/lib/gw2/map/continents.rb +0 -7
  50. data/lib/gw2/map/map_floor.rb +0 -7
  51. data/lib/gw2/map/maps.rb +0 -13
  52. data/lib/gw2/misc/build.rb +0 -8
  53. data/lib/gw2/misc/colors.rb +0 -7
  54. data/lib/gw2/misc/files.rb +0 -7
  55. data/lib/gw2/recipe/recipe_details.rb +0 -7
  56. data/lib/gw2/recipe/recipes.rb +0 -7
  57. data/lib/gw2/wvw/match_details.rb +0 -7
  58. data/lib/gw2/wvw/matches.rb +0 -7
  59. data/lib/gw2/wvw/objective_names.rb +0 -7
  60. data/spec/event/event_names_spec.rb +0 -22
  61. data/spec/event/events_spec.rb +0 -55
  62. data/spec/event/map_names_spec.rb +0 -22
  63. data/spec/event/world_names_spec.rb +0 -22
  64. data/spec/guild/guild_details_spec.rb +0 -37
  65. data/spec/item/item_details_spec.rb +0 -34
  66. data/spec/item/items_spec.rb +0 -22
  67. data/spec/map/continents_spec.rb +0 -40
  68. data/spec/map/map_floor_spec.rb +0 -76
  69. data/spec/map/maps_spec.rb +0 -79
  70. data/spec/misc/build_spec.rb +0 -22
  71. data/spec/misc/colors_spec.rb +0 -51
  72. data/spec/misc/files_spec.rb +0 -26
  73. data/spec/recipe/recipe_details_spec.rb +0 -34
  74. data/spec/recipe/recipes_spec.rb +0 -22
  75. data/spec/wvw/match_details_spec.rb +0 -108
  76. data/spec/wvw/matches_spec.rb +0 -25
  77. data/spec/wvw/objective_names_spec.rb +0 -25
@@ -0,0 +1,55 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::WvW do
4
+ describe ".objective_names" do
5
+ before :each do
6
+ @objective_names = [
7
+ {"id" => "30","name" => "Tower"},
8
+ {"id" => "57","name" => "Tower"}
9
+ ]
10
+ end
11
+
12
+ it "exists" do
13
+ expect(GW2::WvW.respond_to?(:objective_names)).to eq(true)
14
+ end
15
+
16
+ it "returns all objectives", :vcr do
17
+ expect(GW2::WvW.objective_names).to include(*@objective_names)
18
+ end
19
+ end
20
+
21
+ describe ".matches" do
22
+ before :each do
23
+ @match = {
24
+ "wvw_match_id"=>"1-6",
25
+ "red_world_id"=>1022,
26
+ "blue_world_id"=>1001,
27
+ "green_world_id"=>1007,
28
+ "start_time"=>"2015-02-21T01:00:00Z",
29
+ "end_time"=>"2015-02-28T01:00:00Z"
30
+ }
31
+ end
32
+
33
+ it "exists" do
34
+ expect(GW2::WvW.respond_to?(:matches)).to eq(true)
35
+ end
36
+
37
+ it "returns all matches", :vcr do
38
+ expect(GW2::WvW.matches).to include(@match)
39
+ end
40
+ end
41
+
42
+ describe ".match_details" do
43
+ before :each do
44
+ @scores = [85114, 17896, 25292]
45
+ end
46
+
47
+ it "exists" do
48
+ expect(GW2::WvW.respond_to?(:match_details)).to eq(true)
49
+ end
50
+
51
+ it "returns the details of a match", :vcr do
52
+ expect(GW2::WvW.match_details("2-3")[0]["scores"]).to eq(@scores)
53
+ end
54
+ end
55
+ end
@@ -1,5 +1,7 @@
1
1
  require "rspec"
2
2
  require "webmock/rspec"
3
+ require "vcr"
4
+ require "coveralls"
3
5
  require "gw2"
4
6
 
5
7
  RSpec.configure do |config|
@@ -16,3 +18,11 @@ RSpec.configure do |config|
16
18
  # instead of true.
17
19
  # config.use_transactional_fixtures = false
18
20
  end
21
+
22
+ VCR.configure do |config|
23
+ config.cassette_library_dir = "spec/fixtures"
24
+ config.hook_into :webmock # or :fakeweb
25
+ config.configure_rspec_metadata!
26
+ end
27
+
28
+ Coveralls.wear!
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gw2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Chris Rosario
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A ruby gem for accessing the Guild Wars 2 API
15
14
  email: c.allen.rosario@gmail.com
@@ -17,99 +16,97 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
20
- - LICENSE.md
21
19
  - CHANGELOG.md
20
+ - LICENSE.md
22
21
  - README.md
23
22
  - gw2.gemspec
24
- - lib/gw2/event/event_names.rb
25
- - lib/gw2/event/events.rb
26
- - lib/gw2/event/map_names.rb
27
- - lib/gw2/event/world_names.rb
23
+ - lib/gw2.rb
24
+ - lib/gw2/disabled.rb
28
25
  - lib/gw2/event.rb
29
- - lib/gw2/guild/guild_details.rb
30
26
  - lib/gw2/guild.rb
31
27
  - lib/gw2/https.rb
32
- - lib/gw2/item/item_details.rb
33
- - lib/gw2/item/items.rb
34
28
  - lib/gw2/item.rb
35
29
  - lib/gw2/json.rb
36
- - lib/gw2/map/continents.rb
37
- - lib/gw2/map/map_floor.rb
38
- - lib/gw2/map/maps.rb
39
30
  - lib/gw2/map.rb
40
- - lib/gw2/misc/build.rb
41
- - lib/gw2/misc/colors.rb
42
- - lib/gw2/misc/files.rb
43
31
  - lib/gw2/misc.rb
44
- - lib/gw2/recipe/recipe_details.rb
45
- - lib/gw2/recipe/recipes.rb
46
32
  - lib/gw2/recipe.rb
47
- - lib/gw2/wvw/match_details.rb
48
- - lib/gw2/wvw/matches.rb
49
- - lib/gw2/wvw/objective_names.rb
50
33
  - lib/gw2/wvw.rb
51
- - lib/gw2.rb
52
- - spec/event/event_names_spec.rb
53
- - spec/event/events_spec.rb
54
- - spec/event/map_names_spec.rb
55
- - spec/event/world_names_spec.rb
56
- - spec/guild/guild_details_spec.rb
57
- - spec/item/item_details_spec.rb
58
- - spec/item/items_spec.rb
59
- - spec/map/continents_spec.rb
60
- - spec/map/map_floor_spec.rb
61
- - spec/map/maps_spec.rb
62
- - spec/misc/build_spec.rb
63
- - spec/misc/colors_spec.rb
64
- - spec/misc/files_spec.rb
65
- - spec/recipe/recipe_details_spec.rb
66
- - spec/recipe/recipes_spec.rb
34
+ - spec/fixtures/GW2_Event/_event_names/returns_the_names_of_all_events.yml
35
+ - spec/fixtures/GW2_Event/_map_names/returns_the_names_of_all_maps.yml
36
+ - spec/fixtures/GW2_Event/_world_names/returns_the_names_of_all_worlds.yml
37
+ - spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_id.yml
38
+ - spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_name.yml
39
+ - spec/fixtures/GW2_Item/_all/returns_all_items.yml
40
+ - spec/fixtures/GW2_Item/_details/returns_the_details_of_the_item.yml
41
+ - spec/fixtures/GW2_Map/_all/returns_all_maps.yml
42
+ - spec/fixtures/GW2_Map/_continents/returns_all_continents.yml
43
+ - spec/fixtures/GW2_Map/_map_floor/returns_a_specific_map_floor.yml
44
+ - spec/fixtures/GW2_Map/_maps/returns_the_map_by_id.yml
45
+ - spec/fixtures/GW2_Misc/_build/returns_the_build.yml
46
+ - spec/fixtures/GW2_Misc/_colors/returns_all_colors.yml
47
+ - spec/fixtures/GW2_Misc/_files/returns_all_files.yml
48
+ - spec/fixtures/GW2_Recipe/_all/returns_all_recipes.yml
49
+ - spec/fixtures/GW2_Recipe/_details/returns_the_details_of_a_recipe_by_id.yml
50
+ - spec/fixtures/GW2_WvW/_match_details/returns_the_details_of_a_match.yml
51
+ - spec/fixtures/GW2_WvW/_matches/returns_all_matches.yml
52
+ - spec/fixtures/GW2_WvW/_objective_names/returns_all_objectives.yml
53
+ - spec/gw2/event_spec.rb
54
+ - spec/gw2/guild_spec.rb
55
+ - spec/gw2/item_spec.rb
56
+ - spec/gw2/map_spec.rb
57
+ - spec/gw2/misc_spec.rb
58
+ - spec/gw2/recipe_spec.rb
59
+ - spec/gw2/wvw_spec.rb
67
60
  - spec/spec_helper.rb
68
- - spec/wvw/match_details_spec.rb
69
- - spec/wvw/matches_spec.rb
70
- - spec/wvw/objective_names_spec.rb
71
61
  homepage: https://github.com/parix/gw2
72
62
  licenses:
73
63
  - MIT
64
+ metadata: {}
74
65
  post_install_message:
75
66
  rdoc_options: []
76
67
  require_paths:
77
68
  - lib
78
69
  required_ruby_version: !ruby/object:Gem::Requirement
79
- none: false
80
70
  requirements:
81
- - - ! '>='
71
+ - - ">="
82
72
  - !ruby/object:Gem::Version
83
73
  version: '0'
84
74
  required_rubygems_version: !ruby/object:Gem::Requirement
85
- none: false
86
75
  requirements:
87
- - - ! '>='
76
+ - - ">="
88
77
  - !ruby/object:Gem::Version
89
78
  version: '0'
90
79
  requirements: []
91
80
  rubyforge_project:
92
- rubygems_version: 1.8.23
81
+ rubygems_version: 2.2.2
93
82
  signing_key:
94
- specification_version: 3
83
+ specification_version: 4
95
84
  summary: Guild Wars 2 API
96
85
  test_files:
97
- - spec/event/event_names_spec.rb
98
- - spec/event/events_spec.rb
99
- - spec/event/map_names_spec.rb
100
- - spec/event/world_names_spec.rb
101
- - spec/guild/guild_details_spec.rb
102
- - spec/item/item_details_spec.rb
103
- - spec/item/items_spec.rb
104
- - spec/map/continents_spec.rb
105
- - spec/map/map_floor_spec.rb
106
- - spec/map/maps_spec.rb
107
- - spec/misc/build_spec.rb
108
- - spec/misc/colors_spec.rb
109
- - spec/misc/files_spec.rb
110
- - spec/recipe/recipe_details_spec.rb
111
- - spec/recipe/recipes_spec.rb
86
+ - spec/fixtures/GW2_Event/_event_names/returns_the_names_of_all_events.yml
87
+ - spec/fixtures/GW2_Event/_map_names/returns_the_names_of_all_maps.yml
88
+ - spec/fixtures/GW2_Event/_world_names/returns_the_names_of_all_worlds.yml
89
+ - spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_id.yml
90
+ - spec/fixtures/GW2_Guild/_details/returns_the_guild_based_on_name.yml
91
+ - spec/fixtures/GW2_Item/_all/returns_all_items.yml
92
+ - spec/fixtures/GW2_Item/_details/returns_the_details_of_the_item.yml
93
+ - spec/fixtures/GW2_Map/_all/returns_all_maps.yml
94
+ - spec/fixtures/GW2_Map/_continents/returns_all_continents.yml
95
+ - spec/fixtures/GW2_Map/_map_floor/returns_a_specific_map_floor.yml
96
+ - spec/fixtures/GW2_Map/_maps/returns_the_map_by_id.yml
97
+ - spec/fixtures/GW2_Misc/_build/returns_the_build.yml
98
+ - spec/fixtures/GW2_Misc/_colors/returns_all_colors.yml
99
+ - spec/fixtures/GW2_Misc/_files/returns_all_files.yml
100
+ - spec/fixtures/GW2_Recipe/_all/returns_all_recipes.yml
101
+ - spec/fixtures/GW2_Recipe/_details/returns_the_details_of_a_recipe_by_id.yml
102
+ - spec/fixtures/GW2_WvW/_match_details/returns_the_details_of_a_match.yml
103
+ - spec/fixtures/GW2_WvW/_matches/returns_all_matches.yml
104
+ - spec/fixtures/GW2_WvW/_objective_names/returns_all_objectives.yml
105
+ - spec/gw2/event_spec.rb
106
+ - spec/gw2/guild_spec.rb
107
+ - spec/gw2/item_spec.rb
108
+ - spec/gw2/map_spec.rb
109
+ - spec/gw2/misc_spec.rb
110
+ - spec/gw2/recipe_spec.rb
111
+ - spec/gw2/wvw_spec.rb
112
112
  - spec/spec_helper.rb
113
- - spec/wvw/match_details_spec.rb
114
- - spec/wvw/matches_spec.rb
115
- - spec/wvw/objective_names_spec.rb
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Event
3
- def self.event_names
4
- parse(request("/event_names.json").body)
5
- end
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- module GW2
2
- module Event
3
- def self.all
4
- self.where
5
- end
6
-
7
- def self.where(query_hash = {})
8
- parse(request("/events.json", query: query_hash).body)
9
- end
10
- end
11
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Event
3
- def self.map_names
4
- parse(request("/map_names.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Event
3
- def self.world_names
4
- parse(request("/world_names.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Guild
3
- def self.details(query_hash = {})
4
- parse(request("/guild_details.json", query: query_hash).body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Item
3
- def self.details(item_id)
4
- parse(request("/item_details.json", query: { item_id: item_id }).body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Item
3
- def self.all
4
- parse(request("/items.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Map
3
- def self.continents
4
- parse(request("/continents.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Map
3
- def self.map_floor(continent_id, floor)
4
- parse(request("/map_floor.json", query: { continent_id: continent_id, floor: floor }).body)
5
- end
6
- end
7
- end
@@ -1,13 +0,0 @@
1
- module GW2
2
- module Map
3
- PARAMS_FILTER = [:map_id]
4
-
5
- def self.all
6
- self.where
7
- end
8
-
9
- def self.where(query_hash = {})
10
- parse(request("/maps.json", query: query_hash).body)
11
- end
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- module GW2
2
- module Misc
3
- def self.build
4
- parse(request("/build.json").body)
5
- end
6
- end
7
- end
8
-
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Misc
3
- def self.colors
4
- parse(request("/colors.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Misc
3
- def self.files
4
- parse(request("/files.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Recipe
3
- def self.details(recipe_id)
4
- parse(request("/recipe_details.json", query: { recipe_id: recipe_id }).body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module Recipe
3
- def self.all
4
- parse(request("/recipes.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module WvW
3
- def self.match_details(match_id)
4
- parse(request("/wvw/match_details.json", query: { match_id: match_id }).body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module WvW
3
- def self.matches
4
- parse(request("/wvw/matches.json").body)
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module GW2
2
- module WvW
3
- def self.objective_names
4
- parse(request("/wvw/objective_names.json").body)
5
- end
6
- end
7
- end
@@ -1,22 +0,0 @@
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