Class: Bnet::Diablo3::Follower

Inherits:
BnetResource show all
Defined in:
lib/bnet/diablo3/follower.rb

Constant Summary

Constants inherited from BnetResource

BnetResource::PARAMS_MAPPING

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BnetResource

#initialize

Constructor Details

This class inherits a constructor from Bnet::BnetResource

Instance Attribute Details

#experience_bonusObject

Returns the value of attribute experience_bonus.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def experience_bonus
  @experience_bonus
end

#follower_typeObject

Returns the value of attribute follower_type.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def follower_type
  @follower_type
end

#gold_findObject

Returns the value of attribute gold_find.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def gold_find
  @gold_find
end

#itemsObject

Returns the value of attribute items.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def items
  @items
end

#levelObject

Returns the value of attribute level.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def level
  @level
end

#magic_findObject

Returns the value of attribute magic_find.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def magic_find
  @magic_find
end

#raw_attributesObject

Returns the value of attribute raw_attributes.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def raw_attributes
  @raw_attributes
end

#skillsObject

Returns the value of attribute skills.



2
3
4
# File 'lib/bnet/diablo3/follower.rb', line 2

def skills
  @skills
end

Class Method Details

.from_api(follower_type, raw_response) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bnet/diablo3/follower.rb', line 8

def self.from_api(follower_type, raw_response)
  follower = new(follower_type: follower_type)
  follower.raw_attributes = raw_response
  follower.level = raw_response["level"]

  assign_items_from_raw_items(follower, raw_response["items"]) if raw_response["items"]
  assign_skills_from_raw_skills(follower, raw_response["skills"]) if raw_response["skills"]

  follower.magic_find = raw_response["stats"]["magicFind"]
  follower.gold_find = raw_response["stats"]["goldFind"]
  follower.experience_bonus =  raw_response["stats"]["experienceBonus"]

  return follower
end