Class: Workarea::Fulfillment::Token

Inherits:
Object
  • Object
show all
Includes:
ApplicationDocument
Defined in:
app/models/workarea/fulfillment/token.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

assert_valid_config!, async, disable, enable, inline, #run_callbacks

Methods included from Mongoid::Document

#embedded_children

Class Method Details

.for_order_item(order_id, item_id) ⇒ Object



19
20
21
# File 'app/models/workarea/fulfillment/token.rb', line 19

def self.for_order_item(order_id, item_id)
  where(order_id: order_id.to_s, order_item_id: item_id.to_s).first
end

.sortsObject



23
24
25
# File 'app/models/workarea/fulfillment/token.rb', line 23

def self.sorts
  [Sort.newest, Sort.modified, Sort.downloads]
end

Instance Method Details

#disabled?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/workarea/fulfillment/token.rb', line 27

def disabled?
  !enabled?
end

#from_user_order?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/workarea/fulfillment/token.rb', line 31

def from_user_order?
  user_id.present? && order_id.present?
end