Class: GoCardlessPro::Resources::Payout

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/payout.rb

Overview

Payouts represent transfers from GoCardless to a [creditor](#core-endpoints-creditors). Each payout contains the funds collected from one or many [payments](#core-endpoints-payments). All the payments in a payout will have been collected in the same currency. Payouts are created automatically after a payment has been successfully collected.

Defined Under Namespace

Classes: Links

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Payout

Initialize a payout resource instance

Parameters:

  • object (Hash)

    an object returned from the API



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gocardless_pro/resources/payout.rb', line 25

def initialize(object, response = nil)
  @object = object

  @amount = object['amount']
  @arrival_date = object['arrival_date']
  @created_at = object['created_at']
  @currency = object['currency']
  @deducted_fees = object['deducted_fees']
  @fx = object['fx']
  @id = object['id']
  @links = object['links']
  @metadata = object['metadata']
  @payout_type = object['payout_type']
  @reference = object['reference']
  @status = object['status']
  @tax_currency = object['tax_currency']
  @response = response
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def amount
  @amount
end

#arrival_dateObject (readonly)

Returns the value of attribute arrival_date.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def arrival_date
  @arrival_date
end

#created_atObject (readonly)

Returns the value of attribute created_at.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def currency
  @currency
end

#deducted_feesObject (readonly)

Returns the value of attribute deducted_fees.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def deducted_fees
  @deducted_fees
end

#fxObject (readonly)

Returns the value of attribute fx.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def fx
  @fx
end

#idObject (readonly)

Returns the value of attribute id.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def 
  @metadata
end

#payout_typeObject (readonly)

Returns the value of attribute payout_type.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def payout_type
  @payout_type
end

#referenceObject (readonly)

Returns the value of attribute reference.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def reference
  @reference
end

#statusObject (readonly)

Returns the value of attribute status.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def status
  @status
end

#tax_currencyObject (readonly)

Returns the value of attribute tax_currency.



20
21
22
# File 'lib/gocardless_pro/resources/payout.rb', line 20

def tax_currency
  @tax_currency
end

Instance Method Details

#api_responseObject



44
45
46
# File 'lib/gocardless_pro/resources/payout.rb', line 44

def api_response
  ApiResponse.new(@response)
end

Return the links that the resource has



49
50
51
# File 'lib/gocardless_pro/resources/payout.rb', line 49

def links
  @payout_links ||= Links.new(@links)
end

#to_hObject

Provides the payout resource as a hash of all its readable attributes



54
55
56
# File 'lib/gocardless_pro/resources/payout.rb', line 54

def to_h
  @object
end