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



71
72
73
74
75
# File 'lib/report.rb', line 71

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

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



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

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



67
68
69
# File 'lib/report.rb', line 67

def self.paginates_per
  self::PER_PAGE
end

Instance Method Details

#export_fieldsObject



77
78
79
# File 'lib/report.rb', line 77

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 |



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

field :item_type, type: String