Class: RiotKit::Models::DataDragon::Rune

Inherits:
Object
  • Object
show all
Defined in:
lib/riot_kit/models/data_dragon/rune.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, name:, short_desc: '', long_desc: '', icon: '') ⇒ Rune

Returns a new instance of Rune.



9
10
11
12
13
14
15
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 9

def initialize(id:, name:, short_desc: '', long_desc: '', icon: '')
  @id = id
  @name = name
  @short_desc = short_desc
  @long_desc = long_desc
  @icon = icon
end

Instance Attribute Details

#iconObject (readonly)

Returns the value of attribute icon.



7
8
9
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 7

def icon
  @icon
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 7

def id
  @id
end

#long_descObject (readonly)

Returns the value of attribute long_desc.



7
8
9
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 7

def long_desc
  @long_desc
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 7

def name
  @name
end

#short_descObject (readonly)

Returns the value of attribute short_desc.



7
8
9
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 7

def short_desc
  @short_desc
end

Class Method Details

.from_hash(hash) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 17

def self.from_hash(hash)
  symbolized = RiotKit::Util::Symbolize.deep_symbolize_keys(hash)
  new(
    id: symbolized[:id].to_i,
    name: symbolized[:name].to_s,
    short_desc: symbolized[:short_desc].to_s,
    long_desc: symbolized[:long_desc].to_s,
    icon: symbolized[:icon].to_s
  )
end

Instance Method Details

#to_hObject



28
29
30
# File 'lib/riot_kit/models/data_dragon/rune.rb', line 28

def to_h
  { id: id, name: name, short_desc: short_desc, long_desc: long_desc, icon: icon }
end