Class: TopTL::GlobalStats

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/toptl/types.rb

Instance Attribute Summary

Attributes included from Model

#raw

Class Method Summary collapse

Methods included from Model

included, #initialize, #to_h

Class Method Details

.from_hash(data) ⇒ Object



180
181
182
183
184
185
186
187
188
189
# File 'lib/toptl/types.rb', line 180

def self.from_hash(data)
  data ||= {}
  new(
    total: (data["total"] || 0).to_i,
    channels: (data["channels"] || 0).to_i,
    groups: (data["groups"] || 0).to_i,
    bots: (data["bots"] || 0).to_i,
    raw: data
  )
end