module PopularPages

Attributes

configuration[RW]

Public Class Methods

configure() { |configuration| ... } click to toggle source
# File lib/popular_pages.rb, line 11
def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end
most_populars(from = 7, to = 1, paths = []) click to toggle source
# File lib/popular_pages.rb, line 16
def self.most_populars(from = 7, to = 1, paths = [])
  all = @rest_client.all(from, to)
  return all if paths.empty?
  populars = []
  paths.each do |path|
    populars += all.select { |page| page[:path].match(/\A\/#{path}/) }
  end
  populars
end