Class: Vk::Stats::Period

Inherits:
Base
  • Object
show all
Defined in:
lib/vk/stats.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

#fields, find, #id, #id=, #identity_map, inherited, #initialize, #inspect, #key_field, #loader, #logger, method_missing, #method_missing, #read_attribute, #respond_to_missing?, #to_hash

Constructor Details

This class inherits a constructor from Vk::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Vk::Base

Instance Method Details

#ageObject



43
44
45
46
47
# File 'lib/vk/stats.rb', line 43

def age
  @age ||= (read_attribute(:age) || []).map do |age|
    Vk::Stats::Age.new(nil, data: age) if age
  end.compact
end

#citiesObject



55
56
57
58
59
# File 'lib/vk/stats.rb', line 55

def cities
  @cities ||= (read_attribute(:cities) || []).map do |city|
    Vk::Stats::City.new(nil, data: city) if city
  end.compact
end

#countriesObject



61
62
63
64
65
# File 'lib/vk/stats.rb', line 61

def countries
  @countries ||= (read_attribute(:countries) || []).map do |country|
    Vk::Stats::Country.new(nil, data: country) if country
  end.compact
end

#dateObject



33
34
35
# File 'lib/vk/stats.rb', line 33

def date
  @date ||= Date.parse(read_attribute(:day))
end

#sexObject



37
38
39
40
41
# File 'lib/vk/stats.rb', line 37

def sex
  @sex ||= (read_attribute(:sex) || []).map do |sex|
    Vk::Stats::Sex.new(nil, data: sex) if sex
  end.compact
end

#sex_ageObject



49
50
51
52
53
# File 'lib/vk/stats.rb', line 49

def sex_age
  @sex_age ||= (read_attribute(:sex_age) || []).map do |sex_age|
    Vk::Stats::SexAge.new(nil, data: sex_age) if sex_age
  end.compact
end