Class: Report

Inherits:
Object
  • Object
show all
Includes:
Ish::PremiumItem, Ish::Utils, Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/report.rb

Constant Summary collapse

PER_PAGE =
10

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Ish::Utils

#export

Methods included from Ish::PremiumItem

included, #is_premium

Class Method Details

.clearObject



54
55
56
57
58
# File 'lib/report.rb', line 54

def self.clear
  if Rails.env.test?
    self.unscoped.each { |r| r.remove }
  end
end

.list(conditions = { :is_trash => false }) ⇒ Object

@TODO: trash, remove



44
45
46
47
# File 'lib/report.rb', line 44

def self.list conditions = { :is_trash => false }
  out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
  [['', nil]] + out.map { |item| [ item.name, item.id ] }
end

.paginates_perObject



50
51
52
# File 'lib/report.rb', line 50

def self.paginates_per
  self::PER_PAGE
end

Instance Method Details

#export_fieldsObject



60
61
62
# File 'lib/report.rb', line 60

def export_fields
  %w| name descr |
end

#item_typeObject

Can be one of: default (nil), longscroll,

wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro

ITEM_TYPES = %w| longscroll wordpress |



21
# File 'lib/report.rb', line 21

field :item_type, type: String