Class: RiotKit::Models::DataDragon::Item
- Inherits:
-
Object
- Object
- RiotKit::Models::DataDragon::Item
- Defined in:
- lib/riot_kit/models/data_dragon/item.rb
Instance Attribute Summary collapse
-
#gold_total ⇒ Object
readonly
Returns the value of attribute gold_total.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#image_full ⇒ Object
readonly
Returns the value of attribute image_full.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plaintext ⇒ Object
readonly
Returns the value of attribute plaintext.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, plaintext: '', gold_total: 0, image_full: '', tags: []) ⇒ Item
constructor
A new instance of Item.
- #to_h ⇒ Object
Constructor Details
#initialize(id:, name:, plaintext: '', gold_total: 0, image_full: '', tags: []) ⇒ Item
Returns a new instance of Item.
9 10 11 12 13 14 15 16 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 9 def initialize(id:, name:, plaintext: '', gold_total: 0, image_full: '', tags: []) @id = id @name = name @plaintext = plaintext @gold_total = gold_total @image_full = image_full @tags = end |
Instance Attribute Details
#gold_total ⇒ Object (readonly)
Returns the value of attribute gold_total.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def gold_total @gold_total end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def id @id end |
#image_full ⇒ Object (readonly)
Returns the value of attribute image_full.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def image_full @image_full end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def name @name end |
#plaintext ⇒ Object (readonly)
Returns the value of attribute plaintext.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def plaintext @plaintext end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
7 8 9 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 7 def @tags end |
Class Method Details
.from_hash(hash) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 18 def self.from_hash(hash) symbolized = RiotKit::Util::Symbolize.deep_symbolize_keys(hash) new( id: symbolized[:id], name: symbolized[:name], plaintext: symbolized[:plaintext].to_s, gold_total: symbolized[:gold_total].to_i, image_full: symbolized[:image_full].to_s, tags: Array(symbolized[:tags]) ) end |
Instance Method Details
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/riot_kit/models/data_dragon/item.rb', line 30 def to_h { id: id, name: name, plaintext: plaintext, gold_total: gold_total, image_full: image_full, tags: } end |