Class: Warcraft::Character::AchievementFragment
- Inherits:
-
Object
- Object
- Warcraft::Character::AchievementFragment
- Defined in:
- lib/warcraft/character/achievements.rb
Instance Method Summary collapse
- #child_criteria ⇒ Array<Hash>
- #child_criteria? ⇒ Boolean
- #completed? ⇒ Boolean
- #completed_at ⇒ Time
- #criteria ⇒ Hash
- #criteria_id ⇒ Integer
- #full_achievement ⇒ Object
- #id ⇒ Integer
-
#initialize(client, data) ⇒ AchievementFragment
constructor
A new instance of AchievementFragment.
- #name ⇒ String
- #url ⇒ String
Constructor Details
#initialize(client, data) ⇒ AchievementFragment
Returns a new instance of AchievementFragment.
40 41 42 43 |
# File 'lib/warcraft/character/achievements.rb', line 40 def initialize(client, data) @client = client @data = data end |
Instance Method Details
#child_criteria ⇒ Array<Hash>
75 76 77 |
# File 'lib/warcraft/character/achievements.rb', line 75 def child_criteria has_child_criteria? ? @data.dig(:criteria, :child_criteria) : [] end |
#child_criteria? ⇒ Boolean
70 71 72 |
# File 'lib/warcraft/character/achievements.rb', line 70 def child_criteria? @data[:criteria].key? :child_criteria end |
#completed? ⇒ Boolean
85 86 87 |
# File 'lib/warcraft/character/achievements.rb', line 85 def completed? @data.dig(:criteria, :is_completed) end |
#completed_at ⇒ Time
90 91 92 |
# File 'lib/warcraft/character/achievements.rb', line 90 def completed_at ApiResponse.convert_time(@data[:completed_timestamp]) end |
#criteria ⇒ Hash
65 66 67 |
# File 'lib/warcraft/character/achievements.rb', line 65 def criteria @data[:criteria] end |
#criteria_id ⇒ Integer
80 81 82 |
# File 'lib/warcraft/character/achievements.rb', line 80 def criteria_id @data.dig(:criteria, :id) end |
#full_achievement ⇒ Object
60 61 62 |
# File 'lib/warcraft/character/achievements.rb', line 60 def full_achievement @client.get(url) end |
#id ⇒ Integer
46 47 48 |
# File 'lib/warcraft/character/achievements.rb', line 46 def id @data[:id] end |
#name ⇒ String
51 52 53 |
# File 'lib/warcraft/character/achievements.rb', line 51 def name @data.dig(:achievement, :name) end |
#url ⇒ String
56 57 58 |
# File 'lib/warcraft/character/achievements.rb', line 56 def url @data.dig(:achievement, :key, :href) end |