diff --git a/lib/gw2/event.rb b/lib/gw2/event.rb index 4b9422e..56e4c05 100644 --- a/lib/gw2/event.rb +++ b/lib/gw2/event.rb @@ -1,11 +1,26 @@ -require "gw2/event/event_names" -require "gw2/event/map_names" -require "gw2/event/world_names" -require "gw2/event/events" - module GW2 module Event extend HTTPS extend JSON + + def self.all + raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology." + end + + def self.where(query_hash = {}) + raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology." + end + + def self.world_names + parse(request("/world_names.json").body) + end + + def self.event_names + parse(request("/event_names.json").body) + end + + def self.map_names + parse(request("/map_names.json").body) + end end end diff --git a/lib/gw2/event/event_names.rb b/lib/gw2/event/event_names.rb deleted file mode 100644 index c15a10d..0000000 --- a/lib/gw2/event/event_names.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Event - def self.event_names - parse(request("/event_names.json").body) - end - end -end diff --git a/lib/gw2/event/events.rb b/lib/gw2/event/events.rb deleted file mode 100644 index d970b91..0000000 --- a/lib/gw2/event/events.rb +++ /dev/null @@ -1,11 +0,0 @@ -module GW2 - module Event - def self.all - raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology." - end - - def self.where(query_hash = {}) - raise GW2::Disabled, "This endpoint is disabled due to the implementation of Megaserver technology." - end - end -end diff --git a/lib/gw2/event/map_names.rb b/lib/gw2/event/map_names.rb deleted file mode 100644 index 4a0fb1a..0000000 --- a/lib/gw2/event/map_names.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Event - def self.map_names - parse(request("/map_names.json").body) - end - end -end diff --git a/lib/gw2/event/world_names.rb b/lib/gw2/event/world_names.rb deleted file mode 100644 index d858607..0000000 --- a/lib/gw2/event/world_names.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Event - def self.world_names - parse(request("/world_names.json").body) - end - end -end diff --git a/lib/gw2/guild.rb b/lib/gw2/guild.rb index ecf0787..c479635 100644 --- a/lib/gw2/guild.rb +++ b/lib/gw2/guild.rb @@ -1,8 +1,10 @@ -require "gw2/guild/guild_details" - module GW2 module Guild extend HTTPS extend JSON + + def self.details(query_hash = {}) + parse(request("/guild_details.json", query: query_hash).body) + end end end diff --git a/lib/gw2/guild/guild_details.rb b/lib/gw2/guild/guild_details.rb deleted file mode 100644 index ec97cb8..0000000 --- a/lib/gw2/guild/guild_details.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Guild - def self.details(query_hash = {}) - parse(request("/guild_details.json", query: query_hash).body) - end - end -end diff --git a/lib/gw2/item.rb b/lib/gw2/item.rb index 0d2ba2b..5d174fc 100644 --- a/lib/gw2/item.rb +++ b/lib/gw2/item.rb @@ -1,9 +1,14 @@ -require "gw2/item/items" -require "gw2/item/item_details" - module GW2 module Item extend HTTPS extend JSON + + def self.all + parse(request("/items.json").body)["items"] + end + + def self.details(item_id) + parse(request("/item_details.json", query: { item_id: item_id }).body) + end end end diff --git a/lib/gw2/item/item_details.rb b/lib/gw2/item/item_details.rb deleted file mode 100644 index 59bd84f..0000000 --- a/lib/gw2/item/item_details.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Item - def self.details(item_id) - parse(request("/item_details.json", query: { item_id: item_id }).body) - end - end -end diff --git a/lib/gw2/item/items.rb b/lib/gw2/item/items.rb deleted file mode 100644 index fff7420..0000000 --- a/lib/gw2/item/items.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Item - def self.all - parse(request("/items.json").body)["items"] - end - end -end diff --git a/lib/gw2/map.rb b/lib/gw2/map.rb index 9491944..4208926 100644 --- a/lib/gw2/map.rb +++ b/lib/gw2/map.rb @@ -1,10 +1,24 @@ -require "gw2/map/continents" -require "gw2/map/maps" -require "gw2/map/map_floor" - module GW2 module Map extend HTTPS extend JSON + + PARAMS_FILTER = [:map_id] + + def self.all + self.where + end + + def self.where(query_hash = {}) + parse(request("/maps.json", query: query_hash).body)["maps"] + end + + def self.map_floor(continent_id, floor) + parse(request("/map_floor.json", query: { continent_id: continent_id, floor: floor }).body) + end + + def self.continents + parse(request("/continents.json").body)["continents"] + end end end diff --git a/lib/gw2/map/continents.rb b/lib/gw2/map/continents.rb deleted file mode 100644 index 36e5ae5..0000000 --- a/lib/gw2/map/continents.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Map - def self.continents - parse(request("/continents.json").body)["continents"] - end - end -end diff --git a/lib/gw2/map/map_floor.rb b/lib/gw2/map/map_floor.rb deleted file mode 100644 index b1c84a4..0000000 --- a/lib/gw2/map/map_floor.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Map - def self.map_floor(continent_id, floor) - parse(request("/map_floor.json", query: { continent_id: continent_id, floor: floor }).body) - end - end -end diff --git a/lib/gw2/map/maps.rb b/lib/gw2/map/maps.rb deleted file mode 100644 index 6f69c86..0000000 --- a/lib/gw2/map/maps.rb +++ /dev/null @@ -1,13 +0,0 @@ -module GW2 - module Map - PARAMS_FILTER = [:map_id] - - def self.all - self.where - end - - def self.where(query_hash = {}) - parse(request("/maps.json", query: query_hash).body)["maps"] - end - end -end diff --git a/lib/gw2/misc.rb b/lib/gw2/misc.rb index 8695ad9..c19f5e3 100644 --- a/lib/gw2/misc.rb +++ b/lib/gw2/misc.rb @@ -1,10 +1,18 @@ -require "gw2/misc/build" -require "gw2/misc/colors" -require "gw2/misc/files" - module GW2 module Misc extend HTTPS extend JSON + + def self.build + parse(request("/build.json").body)["build_id"] + end + + def self.colors + parse(request("/colors.json").body)["colors"] + end + + def self.files + parse(request("/files.json").body) + end end end diff --git a/lib/gw2/misc/build.rb b/lib/gw2/misc/build.rb deleted file mode 100644 index d911440..0000000 --- a/lib/gw2/misc/build.rb +++ /dev/null @@ -1,8 +0,0 @@ -module GW2 - module Misc - def self.build - parse(request("/build.json").body)["build_id"] - end - end -end - diff --git a/lib/gw2/misc/colors.rb b/lib/gw2/misc/colors.rb deleted file mode 100644 index 0bc379e..0000000 --- a/lib/gw2/misc/colors.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Misc - def self.colors - parse(request("/colors.json").body)["colors"] - end - end -end diff --git a/lib/gw2/misc/files.rb b/lib/gw2/misc/files.rb deleted file mode 100644 index dbc0e63..0000000 --- a/lib/gw2/misc/files.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Misc - def self.files - parse(request("/files.json").body) - end - end -end diff --git a/lib/gw2/recipe.rb b/lib/gw2/recipe.rb index 8a9b90d..675fcab 100644 --- a/lib/gw2/recipe.rb +++ b/lib/gw2/recipe.rb @@ -1,9 +1,14 @@ -require "gw2/recipe/recipes" -require "gw2/recipe/recipe_details" - module GW2 module Recipe extend HTTPS extend JSON + + def self.all + parse(request("/recipes.json").body)["recipes"] + end + + def self.details(recipe_id) + parse(request("/recipe_details.json", query: { recipe_id: recipe_id }).body) + end end end diff --git a/lib/gw2/recipe/recipe_details.rb b/lib/gw2/recipe/recipe_details.rb deleted file mode 100644 index 0b415ff..0000000 --- a/lib/gw2/recipe/recipe_details.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Recipe - def self.details(recipe_id) - parse(request("/recipe_details.json", query: { recipe_id: recipe_id }).body) - end - end -end diff --git a/lib/gw2/recipe/recipes.rb b/lib/gw2/recipe/recipes.rb deleted file mode 100644 index e1d268d..0000000 --- a/lib/gw2/recipe/recipes.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module Recipe - def self.all - parse(request("/recipes.json").body)["recipes"] - end - end -end diff --git a/lib/gw2/wvw.rb b/lib/gw2/wvw.rb index 73767c6..cfcf630 100644 --- a/lib/gw2/wvw.rb +++ b/lib/gw2/wvw.rb @@ -1,10 +1,18 @@ -require "gw2/wvw/matches" -require "gw2/wvw/match_details" -require "gw2/wvw/objective_names" - module GW2 module WvW extend HTTPS extend JSON + + def self.matches + parse(request("/wvw/matches.json").body)["wvw_matches"] + end + + def self.match_details(match_id) + parse(request("/wvw/match_details.json", query: { match_id: match_id }).body)["maps"] + end + + def self.objective_names + parse(request("/wvw/objective_names.json").body) + end end end diff --git a/lib/gw2/wvw/match_details.rb b/lib/gw2/wvw/match_details.rb deleted file mode 100644 index 5bd7855..0000000 --- a/lib/gw2/wvw/match_details.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module WvW - def self.match_details(match_id) - parse(request("/wvw/match_details.json", query: { match_id: match_id }).body)["maps"] - end - end -end diff --git a/lib/gw2/wvw/matches.rb b/lib/gw2/wvw/matches.rb deleted file mode 100644 index 6e0e48f..0000000 --- a/lib/gw2/wvw/matches.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module WvW - def self.matches - parse(request("/wvw/matches.json").body)["wvw_matches"] - end - end -end diff --git a/lib/gw2/wvw/objective_names.rb b/lib/gw2/wvw/objective_names.rb deleted file mode 100644 index 7a92ccb..0000000 --- a/lib/gw2/wvw/objective_names.rb +++ /dev/null @@ -1,7 +0,0 @@ -module GW2 - module WvW - def self.objective_names - parse(request("/wvw/objective_names.json").body) - end - end -end