Class: Mollie::Subscription

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

Direct Known Subclasses

Customer::Subscription

Constant Summary collapse

STATUS_ACTIVE =
'active'.freeze
STATUS_PENDING =

Waiting for a valid mandate.

'pending'.freeze
STATUS_CANCELED =
'canceled'.freeze
STATUS_SUSPENDED =

Active, but mandate became invalid.

'suspended'.freeze
STATUS_COMPLETED =
'completed'.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes

Instance Method Summary collapse

Methods inherited from Base

all, #assign_attributes, cancel, create, #delete, delete, get, id_param, #initialize, parent_id, request, resource_name, update, #update

Constructor Details

This class inherits a constructor from Mollie::Base

Instance Attribute Details

Returns the value of attribute _links.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def _links
  @_links
end

#amountObject

Returns the value of attribute amount.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def amount
  @amount
end

#application_feeObject

Returns the value of attribute application_fee.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def application_fee
  @application_fee
end

#canceled_atObject

Returns the value of attribute canceled_at.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def canceled_at
  @canceled_at
end

#created_atObject

Returns the value of attribute created_at.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def created_at
  @created_at
end

#customer_idObject

Returns the value of attribute customer_id.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def customer_id
  @customer_id
end

#descriptionObject

Returns the value of attribute description.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def description
  @description
end

#idObject

Returns the value of attribute id.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def id
  @id
end

#intervalObject

Returns the value of attribute interval.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def interval
  @interval
end

#mandate_idObject

Returns the value of attribute mandate_id.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def mandate_id
  @mandate_id
end

#metadataObject

Returns the value of attribute metadata.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def 
  @metadata
end

#methodObject

Returns the value of attribute method.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def method
  @method
end

#modeObject

Returns the value of attribute mode.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def mode
  @mode
end

#next_payment_dateObject

Returns the value of attribute next_payment_date.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def next_payment_date
  @next_payment_date
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def status
  @status
end

#timesObject

Returns the value of attribute times.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def times
  @times
end

#times_remainingObject

Returns the value of attribute times_remaining.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def times_remaining
  @times_remaining
end

#webhook_urlObject

Returns the value of attribute webhook_url.



9
10
11
# File 'lib/mollie/subscription.rb', line 9

def webhook_url
  @webhook_url
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/mollie/subscription.rb', line 30

def active?
  status == STATUS_ACTIVE
end

#canceled?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/mollie/subscription.rb', line 42

def canceled?
  status == STATUS_CANCELED
end

#completed?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/mollie/subscription.rb', line 46

def completed?
  status == STATUS_COMPLETED
end

#customer(options = {}) ⇒ Object



82
83
84
# File 'lib/mollie/subscription.rb', line 82

def customer(options = {})
  Customer.get(customer_id, options)
end

#payments(options = {}) ⇒ Object



86
87
88
89
90
91
# File 'lib/mollie/subscription.rb', line 86

def payments(options = {})
  resource_url = Util.extract_url(links, 'payments')
  return if resource_url.nil?
  response = Mollie::Client.instance.perform_http_call('GET', resource_url, nil, {}, options)
  Mollie::List.new(response, Mollie::Payment)
end

#pending?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/mollie/subscription.rb', line 34

def pending?
  status == STATUS_PENDING
end

#suspended?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/mollie/subscription.rb', line 38

def suspended?
  status == STATUS_SUSPENDED
end