Class: Report
- Inherits:
-
Object
- Object
- Report
- Includes:
- Ish::PremiumItem, Ish::Utils, Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/report.rb
Constant Summary collapse
- PER_PAGE =
10
Class Method Summary collapse
- .clear ⇒ Object
-
.list(conditions = { :is_trash => false }) ⇒ Object
@TODO: trash, remove.
- .paginates_per ⇒ Object
Instance Method Summary collapse
- #export_fields ⇒ Object
-
#item_type ⇒ Object
Can be one of: default (nil), longscroll, wordpress e.g.
Methods included from Ish::Utils
Methods included from Ish::PremiumItem
Class Method Details
.clear ⇒ Object
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_per ⇒ Object
51 52 53 |
# File 'lib/report.rb', line 51 def self.paginates_per self::PER_PAGE end |
Instance Method Details
#export_fields ⇒ Object
61 62 63 |
# File 'lib/report.rb', line 61 def export_fields %w| name descr | end |
#item_type ⇒ Object
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 |