Class: Katello::Pool

Inherits:
Model
  • Object
show all
Includes:
Glue::Candlepin::CandlepinObject, Glue::Candlepin::Pool, Authorization::Pool
Defined in:
app/models/katello/pool.rb

Constant Summary collapse

DAYS_EXPIRING_SOON =
120
DAYS_RECENTLY_EXPIRED =
30

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#destroy!

Instance Attribute Details

#quantity_attachedObject

Returns the value of attribute quantity_attached.



5
6
7
# File 'app/models/katello/pool.rb', line 5

def quantity_attached
  @quantity_attached
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'app/models/katello/pool.rb', line 41

def active?
  active
end

#expiring_soon?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'app/models/katello/pool.rb', line 45

def expiring_soon?
  (end_date.to_date - Date.today) <= DAYS_EXPIRING_SOON
end

#productsObject



62
63
64
# File 'app/models/katello/pool.rb', line 62

def products
  self.subscription.products if self.subscription
end

#quantity_availableObject



53
54
55
56
# File 'app/models/katello/pool.rb', line 53

def quantity_available
  return 0 unless self.quantity && self.consumed
  self.quantity - self.consumed
end

#recently_expired?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'app/models/katello/pool.rb', line 49

def recently_expired?
  Date.today >= end_date.to_date && (Date.today - end_date.to_date) <= DAYS_RECENTLY_EXPIRED
end

#typeObject



58
59
60
# File 'app/models/katello/pool.rb', line 58

def type
  self.pool_type
end