Class: SimpleInvoice::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_invoice/subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#billing_period_typeObject

Returns the value of attribute billing_period_type.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def billing_period_type
  @billing_period_type
end

#cancelledObject

Returns the value of attribute cancelled.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def cancelled
  @cancelled
end

#contactObject

Returns the value of attribute contact.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def contact
  @contact
end

#due_daysObject

Returns the value of attribute due_days.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def due_days
  @due_days
end

#invoice_templateObject

Returns the value of attribute invoice_template.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def invoice_template
  @invoice_template
end

#start_dateObject

Returns the value of attribute start_date.



4
5
6
# File 'lib/simple_invoice/subscription.rb', line 4

def start_date
  @start_date
end

Instance Method Details

#billing_periodsEnumerator

Returns:

  • (Enumerator)


15
16
17
18
19
20
21
22
23
# File 'lib/simple_invoice/subscription.rb', line 15

def billing_periods
  Enumerator.new do |y|
    period = BillingPeriod.new billing_period_type, start_date
    loop do
      y.yield period
      period = period.next_billing_period
    end
  end
end

#cancel!Object



6
7
8
# File 'lib/simple_invoice/subscription.rb', line 6

def cancel!
  @cancelled = true
end

#cancelled?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/simple_invoice/subscription.rb', line 10

def cancelled?
  !!@cancelled
end