class GoCardless::PreAuthorization

Attributes

amount[RW]
currency[RW]
description[RW]
interval_length[RW]
interval_unit[RW]
max_amount[RW]
name[RW]
remaining_amount[RW]
setup_fee[RW]
status[RW]

Public Instance Methods

active?() click to toggle source
# File lib/gocardless/pre_authorization.rb, line 38
def active?
  status == 'active'
end
cancel!() click to toggle source
# File lib/gocardless/pre_authorization.rb, line 29
def cancel!
  path = self.class.endpoint.gsub(':id', id.to_s) + '/cancel'
  client.api_put(path)
end
cancelled?() click to toggle source
# File lib/gocardless/pre_authorization.rb, line 42
def cancelled?
  status == 'cancelled'
end
create_bill(attrs) click to toggle source

Create a new bill under this pre-authorization. Similar to {Client#create_bill}, but only requires the amount to be specified.

@option attrs [amount] amount the bill amount in pence @return [Bill] the created bill object

# File lib/gocardless/pre_authorization.rb, line 25
def create_bill(attrs)
  Bill.new_with_client(client, attrs.merge(:source => self)).save
end
expired?() click to toggle source
# File lib/gocardless/pre_authorization.rb, line 46
def expired?
  status == 'expired'
end
inactive?() click to toggle source
# File lib/gocardless/pre_authorization.rb, line 34
def inactive?
  status == 'inactive'
end