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



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

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

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

@TODO: trash, remove



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

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



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

def self.paginates_per
  self::PER_PAGE
end

Instance Method Details

#export_fieldsObject



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

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