Class: GoCardless::Subscription

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

Instance Attribute Summary collapse

Attributes inherited from Resource

#id, #uri

Instance Method Summary collapse

Methods inherited from Resource

creatable, creatable?, date_accessor, date_writer, find, find_with_client, #initialize, #inspect, new_with_client, #persisted?, reference_accessor, reference_reader, reference_writer, #save, #to_hash, #to_json, updatable, updatable?

Constructor Details

This class inherits a constructor from GoCardless::Resource

Instance Attribute Details

#amountObject

Returns the value of attribute amount


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

def amount
  @amount
end

#currencyObject

Returns the value of attribute currency


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

def currency
  @currency
end

#descriptionObject

Returns the value of attribute description


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

def description
  @description
end

#interval_lengthObject

Returns the value of attribute interval_length


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

def interval_length
  @interval_length
end

#interval_unitObject

Returns the value of attribute interval_unit


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

def interval_unit
  @interval_unit
end

#nameObject

Returns the value of attribute name


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

def name
  @name
end

#setup_feeObject

Returns the value of attribute setup_fee


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

def setup_fee
  @setup_fee
end

#statusObject

Returns the value of attribute status


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

def status
  @status
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)

28
29
30
# File 'lib/gocardless/subscription.rb', line 28

def active?
  status == 'active'
end

#cancel!Object


19
20
21
22
# File 'lib/gocardless/subscription.rb', line 19

def cancel!
  path = self.class.endpoint.gsub(':id', id.to_s) + '/cancel'
  client.api_put(path)
end

#cancelled?Boolean

Returns:

  • (Boolean)

32
33
34
# File 'lib/gocardless/subscription.rb', line 32

def cancelled?
  status == 'cancelled'
end

#expired?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/gocardless/subscription.rb', line 36

def expired?
  status == 'expired'
end

#inactive?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/gocardless/subscription.rb', line 24

def inactive?
  status == 'inactive'
end