Module: Vk::Stats

Defined in:
lib/vk/stats.rb

Defined Under Namespace

Classes: Age, City, Country, Period, Sex, SexAge

Constant Summary collapse

TIME_FORMAT =
'%Y-%m-%d'

Class Method Summary collapse

Class Method Details

.get(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :group_id (Fixnum)
  • :app_id (Fixnum)
  • :date_from (#to_date)
  • :date_to (#to_date)


20
21
22
23
24
25
# File 'lib/vk/stats.rb', line 20

def get(options = {})
  options[:date_from] = options[:date_from].to_date.strftime(TIME_FORMAT) if options.key?(:date_from)
  options[:date_to] = options[:date_to].to_date.strftime(TIME_FORMAT) if options.key?(:date_to)
  result = loader.request('stats.get', options)
  result.map { |period| Period.new(period['day'], data: period) } if result
end