Class: Bnet::BnetResource
- Inherits:
-
Object
- Object
- Bnet::BnetResource
- Defined in:
- lib/bnet/bnet_resource.rb
Direct Known Subclasses
Diablo3::Career, Diablo3::Follower, Diablo3::Hero, Diablo3::Item, Diablo3::Skill, Starcraft2::Career, Starcraft2::Ladder, Starcraft2::Match, Starcraft2::Profile, WOW::Character, WOW::Data::Base
Constant Summary collapse
- PARAMS_MAPPING =
[]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ BnetResource
constructor
A new instance of BnetResource.
Constructor Details
#initialize(args = {}) ⇒ BnetResource
Returns a new instance of BnetResource.
5 6 7 8 9 |
# File 'lib/bnet/bnet_resource.rb', line 5 def initialize args = {} args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end |
Class Method Details
.from_api(raw_response) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/bnet/bnet_resource.rb', line 11 def self.from_api(raw_response) new_hash = {} params_mapping.each do |old_key, new_key| if raw_response.has_key?(old_key) new_hash[new_key] = raw_response[old_key] end end bnet_resource = self.new(new_hash) end |