Class: WowCommunityApi::BattleNet

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/wow_community_api/battle_net.rb

Direct Known Subclasses

Character, Guild, Realm

Constant Summary collapse

DEFAULT_REGION =

TODO: make this configurable?

Regions::US
DEFAULT_LOCALE =
nil

Class Method Summary collapse

Class Method Details

.build_query(options) ⇒ Object



19
20
21
22
23
# File 'lib/wow_community_api/battle_net.rb', line 19

def self.build_query(options)
  query = { :query => options }
  query[:query].merge!(:locale => locale) if locale
  query
end

.get(path, options = nil) ⇒ Object



12
13
14
15
16
17
# File 'lib/wow_community_api/battle_net.rb', line 12

def self.get(path, options = nil)
  base_uri "http://#{self.region}/api/wow"

  results = super(URI.encode(path), build_query(options))
  results.parsed_response if results.response.code == "200"
end

.reset!Object



25
26
27
28
# File 'lib/wow_community_api/battle_net.rb', line 25

def self.reset!
  self.region = DEFAULT_REGION
  self.locale = DEFAULT_LOCALE
end