Class: Bnet::API
- Inherits:
-
Object
- Object
- Bnet::API
- Defined in:
- lib/bnet/api.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#region ⇒ Object
FIXME : get the API to append the :key param to the end of each ‘get’ call.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ API
constructor
A new instance of API.
- #url ⇒ Object
Constructor Details
#initialize(args) ⇒ API
Returns a new instance of API.
6 7 8 9 10 |
# File 'lib/bnet/api.rb', line 6 def initialize args args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Instance Attribute Details
#region ⇒ Object
FIXME : get the API to append the :key param to the end of each ‘get’ call
4 5 6 |
# File 'lib/bnet/api.rb', line 4 def region @region end |
Class Method Details
.valid_call?(status, response) ⇒ Boolean
16 17 18 |
# File 'lib/bnet/api.rb', line 16 def self.valid_call?(status, response) status == ['200', 'OK'] && response["code"] != 'NOTFOUND' end |
Instance Method Details
#url ⇒ Object
12 13 14 |
# File 'lib/bnet/api.rb', line 12 def url "https://#{region}.api.battle.net/" end |