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,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.guildwars2.com/v1/wvw/matches.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Vary:
24
+ - Accept-Encoding
25
+ Server:
26
+ - Microsoft-IIS/7.5
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ Date:
32
+ - Thu, 26 Feb 2015 22:28:27 GMT
33
+ Content-Length:
34
+ - '375'
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"wvw_matches":[{"wvw_match_id":"2-6","red_world_id":2104,"blue_world_id":2105,"green_world_id":2206,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-7","red_world_id":2009,"blue_world_id":2005,"green_world_id":2207,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-4","red_world_id":2204,"blue_world_id":2205,"green_world_id":2202,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-3","red_world_id":2012,"blue_world_id":2103,"green_world_id":2301,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-5","red_world_id":2013,"blue_world_id":2203,"green_world_id":2014,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"1-2","red_world_id":1021,"blue_world_id":1016,"green_world_id":1009,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"1-1","red_world_id":1017,"blue_world_id":1008,"green_world_id":1019,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"1-5","red_world_id":1014,"blue_world_id":1005,"green_world_id":1010,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"2-8","red_world_id":2011,"blue_world_id":2008,"green_world_id":2102,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-2","red_world_id":2201,"blue_world_id":2101,"green_world_id":2003,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"1-6","red_world_id":1022,"blue_world_id":1001,"green_world_id":1007,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"1-4","red_world_id":1018,"blue_world_id":1015,"green_world_id":1012,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"1-7","red_world_id":1023,"blue_world_id":1020,"green_world_id":1013,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"2-9","red_world_id":2004,"blue_world_id":2001,"green_world_id":2006,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"2-1","red_world_id":2002,"blue_world_id":2007,"green_world_id":2010,"start_time":"2015-02-20T18:00:00Z","end_time":"2015-02-27T18:00:00Z"},{"wvw_match_id":"1-3","red_world_id":1011,"blue_world_id":1004,"green_world_id":1003,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"},{"wvw_match_id":"1-8","red_world_id":1002,"blue_world_id":1006,"green_world_id":1024,"start_time":"2015-02-21T01:00:00Z","end_time":"2015-02-28T01:00:00Z"}]}'
38
+ http_version:
39
+ recorded_at: Thu, 26 Feb 2015 22:28:27 GMT
40
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.guildwars2.com/v1/wvw/objective_names.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Vary:
24
+ - Accept-Encoding
25
+ Server:
26
+ - Microsoft-IIS/7.5
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ X-Content-Type-Options:
30
+ - nosniff
31
+ Date:
32
+ - Thu, 26 Feb 2015 22:27:51 GMT
33
+ Content-Length:
34
+ - '506'
35
+ body:
36
+ encoding: UTF-8
37
+ string: '[{"id":"30","name":"Tower"},{"id":"57","name":"Tower"},{"id":"9","name":"Castle"},{"id":"20","name":"Tower"},{"id":"76","name":"((Temple
38
+ of Lost Prayers))"},{"id":"25","name":"Tower"},{"id":"66","name":"((Carver''s
39
+ Ascent))"},{"id":"32","name":"Keep"},{"id":"47","name":"Tower"},{"id":"37","name":"Keep"},{"id":"60","name":"Lumber
40
+ Mill"},{"id":"27","name":"Keep"},{"id":"5","name":"Red Mine"},{"id":"50","name":"Fishing
41
+ Village"},{"id":"75","name":"((Battle''s Hollow))"},{"id":"16","name":"Tower"},{"id":"42","name":"Tower"},{"id":"40","name":"Tower"},{"id":"35","name":"Tower"},{"id":"70","name":"((Battle''s
42
+ Hollow))"},{"id":"17","name":"Tower"},{"id":"64","name":"((Bauer''s Estate))"},{"id":"48","name":"Quarry"},{"id":"69","name":"((Bauer''s
43
+ Estate))"},{"id":"61","name":"Fishing Village"},{"id":"52","name":"Quarry"},{"id":"74","name":"((Bauer''s
44
+ Estate))"},{"id":"22","name":"Tower"},{"id":"31","name":"Keep"},{"id":"62","name":"((Temple
45
+ of Lost Prayers))"},{"id":"51","name":"Lumber Mill"},{"id":"55","name":"Fishing
46
+ Village"},{"id":"21","name":"Tower"},{"id":"29","name":"Crossroads"},{"id":"2","name":"Keep"},{"id":"18","name":"Tower"},{"id":"38","name":"Tower"},{"id":"15","name":"Tower"},{"id":"63","name":"((Battle''s
47
+ Hollow))"},{"id":"26","name":"Tower"},{"id":"44","name":"Keep"},{"id":"33","name":"Keep"},{"id":"4","name":"Green
48
+ Mill"},{"id":"10","name":"Green Mine"},{"id":"39","name":"Crossroads"},{"id":"6","name":"Red
49
+ Mill"},{"id":"34","name":"Orchard"},{"id":"11","name":"Tower"},{"id":"58","name":"Quarry"},{"id":"45","name":"Tower"},{"id":"54","name":"Lumber
50
+ Mill"},{"id":"12","name":"Tower"},{"id":"71","name":"((Temple of Lost Prayers))"},{"id":"49","name":"Workshop"},{"id":"8","name":"Blue
51
+ Mill"},{"id":"1","name":"Keep"},{"id":"41","name":"Keep"},{"id":"53","name":"Workshop"},{"id":"56","name":"Crossroads"},{"id":"68","name":"((Orchard
52
+ Overlook))"},{"id":"36","name":"Tower"},{"id":"43","name":"Orchard"},{"id":"23","name":"Keep"},{"id":"73","name":"((Orchard
53
+ Overlook))"},{"id":"14","name":"Tower"},{"id":"67","name":"((Carver''s Ascent))"},{"id":"24","name":"Orchard"},{"id":"72","name":"((Carver''s
54
+ Ascent))"},{"id":"3","name":"Keep"},{"id":"19","name":"Tower"},{"id":"28","name":"Tower"},{"id":"65","name":"((Orchard
55
+ Overlook))"},{"id":"46","name":"Keep"},{"id":"59","name":"Workshop"},{"id":"7","name":"Blue
56
+ Mine"},{"id":"13","name":"Tower"}]'
57
+ http_version:
58
+ recorded_at: Thu, 26 Feb 2015 22:27:51 GMT
59
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,66 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Event do
4
+ describe ".event_names" do
5
+ before :each do
6
+ @event = { "id" => "7C2B9506-5C0C-49CA-9C73-3EA740772944",
7
+ "name" => "Skill Challenge: Fight the Quaggan Pirate" }
8
+ end
9
+
10
+ it "exists" do
11
+ expect(GW2::Event.respond_to?(:event_names)).to eq(true)
12
+ end
13
+
14
+ it "returns the names of all events", :vcr do
15
+ expect(GW2::Event.event_names).to include(@event)
16
+ end
17
+ end
18
+
19
+ describe ".world_names" do
20
+ before :each do
21
+ @world = { "id" => "1004", "name" => "Henge of Denravi" }
22
+ end
23
+
24
+ it "exists" do
25
+ expect(GW2::Event.respond_to?(:world_names)).to eq(true)
26
+ end
27
+
28
+ it "returns the names of all worlds", :vcr do
29
+ expect(GW2::Event.world_names).to include(@world)
30
+ end
31
+ end
32
+
33
+ describe ".map_names" do
34
+ before :each do
35
+ @map = { "id" => "15", "name" => "Queensdale" }
36
+ end
37
+
38
+ it "exists" do
39
+ expect(GW2::Event.respond_to?(:map_names)).to eq(true)
40
+ end
41
+
42
+ it "returns the names of all maps", :vcr do
43
+ expect(GW2::Event.map_names).to include(@map)
44
+ end
45
+ end
46
+
47
+ describe ".all" do
48
+ it "exists" do
49
+ expect(GW2::Event.respond_to?(:all)).to eq(true)
50
+ end
51
+
52
+ it "is currently disabled" do
53
+ expect { GW2::Event.all }.to raise_error(GW2::Disabled)
54
+ end
55
+ end
56
+
57
+ describe ".where" do
58
+ it "exists" do
59
+ expect(GW2::Event.respond_to?(:where)).to eq(true)
60
+ end
61
+
62
+ it "is currently disabled" do
63
+ expect { GW2::Event.where(world_id: 1014) }.to raise_error(GW2::Disabled)
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Guild do
4
+ describe ".details" do
5
+ before :each do
6
+ @guild = {
7
+ "guild_id" => "16DB5921-CF1B-48D2-A5A0-2F0AADD9765D",
8
+ "guild_name" => "Ruinous",
9
+ "tag" => "RUIN",
10
+ "emblem" => {
11
+ "background_id" => 25,
12
+ "foreground_id" => 70,
13
+ "flags" => [],
14
+ "background_color_id" => 473,
15
+ "foreground_primary_color_id" => 146,
16
+ "foreground_secondary_color_id" => 146
17
+ }
18
+ }
19
+ end
20
+
21
+ it "exists" do
22
+ expect(GW2::Guild.respond_to?(:details)).to eq(true)
23
+ end
24
+
25
+ it "returns the guild based on id", :vcr do
26
+ expect(GW2::Guild.details(guild_id: "16DB5921-CF1B-48D2-A5A0-2F0AADD9765D")).to eq(@guild)
27
+ end
28
+
29
+ it "returns the guild based on name", :vcr do
30
+ expect(GW2::Guild.details(guild_name: "Ruinous")).to eq(@guild)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,44 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Item do
4
+ describe ".all" do
5
+ before :each do
6
+ @items = [12546, 12547, 12548, 12549]
7
+ end
8
+
9
+ it "exists" do
10
+ expect(GW2::Item.respond_to?(:all)).to eq(true)
11
+ end
12
+
13
+ it "returns all items", :vcr do
14
+ expect(GW2::Item.all).to include(*@items)
15
+ end
16
+ end
17
+
18
+ describe ".details" do
19
+ before :each do
20
+ @item_details = {
21
+ "item_id" => "12546",
22
+ "name" => "Lemongrass",
23
+ "description" => "Ingredient",
24
+ "type" => "CraftingMaterial",
25
+ "level" => "80",
26
+ "rarity" => "Basic",
27
+ "vendor_value" => "9",
28
+ "icon_file_id" => "219490",
29
+ "icon_file_signature" => "DF5612F93A11DB5F53FECA523F50D15DBF5A9AA5",
30
+ "game_types" => ["Activity","Dungeon","Pve","Wvw"],
31
+ "flags" => [],
32
+ "restrictions" => []
33
+ }
34
+ end
35
+
36
+ it "exists" do
37
+ expect(GW2::Item.respond_to?(:details)).to eq(true)
38
+ end
39
+
40
+ it "returns the details of the item", :vcr do
41
+ expect(GW2::Item.details(12546)).to eq(@item_details)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,102 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Map do
4
+ describe ".continents" do
5
+ before :each do
6
+ @continent = {
7
+ "name" => "Tyria",
8
+ "continent_dims" => [ 32768, 32768 ],
9
+ "min_zoom" => 0,
10
+ "max_zoom" => 7,
11
+ "floors" => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
12
+ 18, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -13, -14,
13
+ -15, -16, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 34,
14
+ 36, 37, 40, 38, 39, 42, 44, 45]
15
+ }
16
+ end
17
+
18
+ it "exists" do
19
+ expect(GW2::Map.respond_to?(:continents)).to eq(true)
20
+ end
21
+
22
+ it "returns all continents", :vcr do
23
+ expect(GW2::Map.continents["1"]).to eq(@continent)
24
+ end
25
+ end
26
+
27
+ describe ".all" do
28
+ before :each do
29
+ @map = {
30
+ "map_name" => "A Society Function",
31
+ "min_level" => 10,
32
+ "max_level" => 10,
33
+ "default_floor" => 1,
34
+ "floors" => [1, 2],
35
+ "region_id" => 8,
36
+ "region_name" => "Steamspur Mountains",
37
+ "continent_id" => 1,
38
+ "continent_name" => "Tyria",
39
+ "map_rect" => [
40
+ [-21504, -21504],
41
+ [24576, 21504]
42
+ ],
43
+ "continent_rect" => [
44
+ [10240, 9856],
45
+ [12160, 11648]
46
+ ]
47
+ }
48
+ end
49
+
50
+ it "exists" do
51
+ expect(GW2::Map.respond_to?(:all)).to eq(true)
52
+ end
53
+
54
+ it "returns all maps", :vcr do
55
+ expect(GW2::Map.all["80"]).to eq(@map)
56
+ end
57
+ end
58
+
59
+ describe ".maps" do
60
+ before :each do
61
+ @maps = {
62
+ "80" => {
63
+ "map_name" => "A Society Function",
64
+ "min_level" => 10,
65
+ "max_level" => 10,
66
+ "default_floor" => 1,
67
+ "floors" => [1, 2],
68
+ "region_id" => 8,
69
+ "region_name" => "Steamspur Mountains",
70
+ "continent_id" => 1,
71
+ "continent_name" => "Tyria",
72
+ "map_rect" => [
73
+ [-21504, -21504],
74
+ [24576, 21504]
75
+ ],
76
+ "continent_rect" => [
77
+ [10240, 9856],
78
+ [12160, 11648]
79
+ ]
80
+ }
81
+ }
82
+ end
83
+
84
+ it "exists" do
85
+ expect(GW2::Map.respond_to?(:where)).to eq(true)
86
+ end
87
+
88
+ it "returns the map by id", :vcr do
89
+ expect(GW2::Map.where(map_id: 80)).to eq(@maps)
90
+ end
91
+ end
92
+
93
+ describe ".map_floor" do
94
+ it "exists" do
95
+ expect(GW2::Map.respond_to?(:map_floor)).to eq(true)
96
+ end
97
+
98
+ it "returns a specific map floor", :vcr do
99
+ expect(GW2::Map.map_floor(1, 1)["regions"]["1"]["name"]).to eq("Shiverpeak Mountains")
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,72 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Misc do
4
+ describe ".build" do
5
+ before :each do
6
+ @build = 45662
7
+ end
8
+
9
+ it "exists" do
10
+ expect(GW2::Misc.respond_to?(:build)).to eq(true)
11
+ end
12
+
13
+ it "returns the build", :vcr do
14
+ expect(GW2::Misc.build).to eq(@build)
15
+ end
16
+ end
17
+
18
+ describe ".files" do
19
+ before :each do
20
+ @file = { "file_id" => 528724, "signature" => "5A4E663071250EC72668C09E3C082E595A380BF7" }
21
+ end
22
+
23
+ it "exists" do
24
+ expect(GW2::Misc.respond_to?(:files)).to eq(true)
25
+ end
26
+
27
+ it "returns all files", :vcr do
28
+ expect(GW2::Misc.files["map_complete"]).to eq(@file)
29
+ end
30
+ end
31
+
32
+ describe ".colors" do
33
+ before :each do
34
+ @color = {
35
+ "name" => "Hot Pink",
36
+ "base_rgb" => [ 128, 26, 26 ],
37
+ "cloth" => {
38
+ "brightness" => 14,
39
+ "contrast" => 1.21094,
40
+ "hue" => 340,
41
+ "saturation" => 0.820313,
42
+ "lightness" => 1.44531,
43
+ "rgb" => [ 169, 54, 94 ]
44
+ },
45
+ "leather" => {
46
+ "brightness" => 14,
47
+ "contrast" => 1.21094,
48
+ "hue" => 340,
49
+ "saturation" => 0.703125,
50
+ "lightness" => 1.44531,
51
+ "rgb" => [ 160, 62, 96 ]
52
+ },
53
+ "metal" => {
54
+ "brightness" => 14,
55
+ "contrast" => 1.21094,
56
+ "hue" => 340,
57
+ "saturation" => 0.585938,
58
+ "lightness" => 1.44531,
59
+ "rgb" => [ 151, 69, 98 ]
60
+ }
61
+ }
62
+ end
63
+
64
+ it "exists" do
65
+ expect(GW2::Misc.respond_to?(:colors)).to eq(true)
66
+ end
67
+
68
+ it "returns all colors", :vcr do
69
+ expect(GW2::Misc.colors["126"]).to eq(@color)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,45 @@
1
+ require "spec_helper"
2
+
3
+ describe GW2::Recipe do
4
+ describe ".all" do
5
+ before :each do
6
+ @recipes = [1275, 1276, 1277, 1278, 1279]
7
+ end
8
+
9
+ it "exists" do
10
+ expect(GW2::Recipe.respond_to?(:all)).to eq(true)
11
+ end
12
+
13
+ it "returns all recipes", :vcr do
14
+ expect(GW2::Recipe.all).to include(*@recipes)
15
+ end
16
+ end
17
+
18
+ describe ".details" do
19
+ before :each do
20
+ @recipe_details = {
21
+ "recipe_id" => "1275",
22
+ "type" => "Coat",
23
+ "output_item_id" => "11541",
24
+ "output_item_count" => "1",
25
+ "min_rating" => "25",
26
+ "time_to_craft_ms" => "1000",
27
+ "disciplines"=>["Leatherworker"],
28
+ "flags"=>[],
29
+ "ingredients" => [
30
+ {"item_id" => "19797","count" => "1"},
31
+ {"item_id" => "13094","count" => "1"},
32
+ {"item_id" => "13093","count" => "1"}
33
+ ]
34
+ }
35
+ end
36
+
37
+ it "exists" do
38
+ expect(GW2::Recipe.respond_to?(:details)).to eq(true)
39
+ end
40
+
41
+ it "returns the details of a recipe by id", :vcr do
42
+ expect(GW2::Recipe.details(1275)).to eq(@recipe_details)
43
+ end
44
+ end
45
+ end