Class: GoCardless::PreAuthorization

Inherits:
Resource
  • Object
show all
Defined in:
lib/gocardless/pre_authorization.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

#amount ⇒ Object

Returns the value of attribute amount.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def amount
  @amount
end

#currency ⇒ Object

Returns the value of attribute currency.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def currency
  @currency
end

#description ⇒ Object

Returns the value of attribute description.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def description
  @description
end

#interval_length ⇒ Object

Returns the value of attribute interval_length.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def interval_length
  @interval_length
end

#interval_unit ⇒ Object

Returns the value of attribute interval_unit.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def interval_unit
  @interval_unit
end

#max_amount ⇒ Object

Returns the value of attribute max_amount.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def max_amount
  @max_amount
end

#name ⇒ Object

Returns the value of attribute name.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def name
  @name
end

#next_interval_start ⇒ Object

Returns the value of attribute next_interval_start.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def next_interval_start
  @next_interval_start
end

#plan_id ⇒ Object

Returns the value of attribute plan_id.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def plan_id
  @plan_id
end

#remaining_amount ⇒ Object

Returns the value of attribute remaining_amount.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def remaining_amount
  @remaining_amount
end

#status ⇒ Object

Returns the value of attribute status.



5
6
7
# File 'lib/gocardless/pre_authorization.rb', line 5

def status
  @status
end

Instance Method Details

#create_bill(attrs) ⇒ Bill

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

Parameters:

  • attrs (Hash) —

    a customizable set of options

Options Hash (attrs):

  • amount (amount) —

    the bill amount in pence

Returns:

  • (Bill) —

    the created bill object



25
26
27
# File 'lib/gocardless/pre_authorization.rb', line 25

def create_bill(attrs)
  Bill.new_with_client(client, attrs.merge(:source => self)).save
end