Class: Elekk::Achievement
- Inherits:
-
Object
- Object
- Elekk::Achievement
- Defined in:
- lib/elekk/achievement.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#completed ⇒ Object
Returns the value of attribute completed.
-
#description ⇒ Object
Returns the value of attribute description.
-
#icon ⇒ Object
Returns the value of attribute icon.
-
#id ⇒ Object
Returns the value of attribute id.
-
#points ⇒ Object
Returns the value of attribute points.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(id, opts = {}) ⇒ Achievement
constructor
A new instance of Achievement.
- #wowhead ⇒ Object
Constructor Details
#initialize(id, opts = {}) ⇒ Achievement
Returns a new instance of Achievement.
5 6 7 8 9 10 11 12 13 |
# File 'lib/elekk/achievement.rb', line 5 def initialize(id, opts={}) @id = id @title = opts[:title] @points = opts[:points] @icon = opts[:icon] @description = opts[:description] @category = AchievementCategory[opts[:category]] @completed = opts[:completed] end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def category @category end |
#completed ⇒ Object
Returns the value of attribute completed.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def completed @completed end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def description @description end |
#icon ⇒ Object
Returns the value of attribute icon.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def icon @icon end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def id @id end |
#points ⇒ Object
Returns the value of attribute points.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def points @points end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/elekk/achievement.rb', line 3 def title @title end |
Class Method Details
.from_xml(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/elekk/achievement.rb', line 15 def self.from_xml(node) a = self.new(node['id'].to_i, { :title => node['title'].to_s, :points => node['points'].to_i, :icon => node['icon'].to_s, :description => node['description'].to_s, :category => node['categoryId'].to_i }) a.completed = Time.parse(node['dateCompleted'].to_s) if node['dateCompleted'] a end |