Class: RiotKit::Models::DataDragon::Champion
- Inherits:
-
Object
- Object
- RiotKit::Models::DataDragon::Champion
- Defined in:
- lib/riot_kit/models/data_dragon/champion.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, key:, name:, title: '') ⇒ Champion
constructor
A new instance of Champion.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, key:, name:, title: '') ⇒ Champion
Returns a new instance of Champion.
9 10 11 12 13 14 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 9 def initialize(id:, key:, name:, title: '') @id = id @key = key @name = name @title = title end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 7 def id @id end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 7 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 7 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 7 def title @title end |
Class Method Details
.from_hash(hash) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 16 def self.from_hash(hash) symbolized = RiotKit::Util::Symbolize.deep_symbolize_keys(hash) new( id: symbolized[:id].to_i, key: symbolized[:key].to_s, name: symbolized[:name].to_s, title: symbolized[:title].to_s ) end |
Instance Method Details
#to_h ⇒ Object
26 27 28 |
# File 'lib/riot_kit/models/data_dragon/champion.rb', line 26 def to_h { id: id, key: key, name: name, title: title } end |