Class: Starling::Resources::PaymentResource
- Inherits:
-
BaseResource
- Object
- BaseResource
- Starling::Resources::PaymentResource
- Defined in:
- lib/starling/resources/payment_resource.rb
Overview
A resource representing a Payment returned from the Payment API
Instance Method Summary collapse
-
#amount ⇒ Float
The amount of the payment.
-
#cancelled_at ⇒ Time?
The time when the payment was cancelled, or nil if it has not been cancelled.
-
#currency ⇒ String
The currency of the payment.
-
#immediate ⇒ true, false
Where the payment is immediate or scheduled for the future.
-
#next_date ⇒ Date
The date of the next payment in the series.
-
#payment_order_id ⇒ String
(also: #id)
The Starling internal ID of the payment.
-
#payment_type ⇒ Symbol
The type of the payment (e.g. ‘:standing_order`) (these values do not seem to be accurate!).
-
#receiving_contact_account_id ⇒ String
The Starling internal ID of the contact account the payment is/was sent to.
-
#recipient_name ⇒ String
The name of the recipient of the payment.
-
#recurrence_rule ⇒ Hash?
Returns a Hash describing the recurrence behaviour of the payment, or nil if the payment is not recurring.
-
#reference ⇒ String
The reference of the payment.
-
#start_date ⇒ Date
The start date of the payment.
Methods inherited from BaseResource
Constructor Details
This class inherits a constructor from Starling::Resources::BaseResource
Instance Method Details
#amount ⇒ Float
Returns the amount of the payment.
17 18 19 |
# File 'lib/starling/resources/payment_resource.rb', line 17 def amount present_float(parsed_data['amount']) end |
#cancelled_at ⇒ Time?
Returns the time when the payment was cancelled, or nil if it has not been cancelled.
67 68 69 |
# File 'lib/starling/resources/payment_resource.rb', line 67 def cancelled_at present_datetime(parsed_data['cancelledAt']) end |
#currency ⇒ String
Returns the currency of the payment.
12 13 14 |
# File 'lib/starling/resources/payment_resource.rb', line 12 def currency parsed_data['currency'] end |
#immediate ⇒ true, false
Returns where the payment is immediate or scheduled for the future.
38 39 40 |
# File 'lib/starling/resources/payment_resource.rb', line 38 def immediate parsed_data['immediate'] end |
#next_date ⇒ Date
Returns the date of the next payment in the series.
61 62 63 |
# File 'lib/starling/resources/payment_resource.rb', line 61 def next_date present_date(parsed_data['nextDate']) end |
#payment_order_id ⇒ String Also known as: id
Returns the Starling internal ID of the payment.
6 7 8 |
# File 'lib/starling/resources/payment_resource.rb', line 6 def payment_order_id parsed_data['paymentOrderId'] end |
#payment_type ⇒ Symbol
Returns the type of the payment (e.g. ‘:standing_order`) (these values do not seem to be accurate!).
73 74 75 |
# File 'lib/starling/resources/payment_resource.rb', line 73 def payment_type present_enum(parsed_data['paymentType']) end |
#receiving_contact_account_id ⇒ String
Returns the Starling internal ID of the contact account the payment is/was sent to.
28 29 30 |
# File 'lib/starling/resources/payment_resource.rb', line 28 def receiving_contact_account_id parsed_data['receivingContactAccountId'] end |
#recipient_name ⇒ String
Returns the name of the recipient of the payment.
33 34 35 |
# File 'lib/starling/resources/payment_resource.rb', line 33 def recipient_name parsed_data['recipientName'] end |
#recurrence_rule ⇒ Hash?
Returns a Hash describing the recurrence behaviour of the payment, or nil if the payment is not recurring. The values in the Hash will be parsed directly from JSON (e.g. dates will appear as strings).
TODO: Consider replacing this with its own resource
51 52 53 |
# File 'lib/starling/resources/payment_resource.rb', line 51 def recurrence_rule parsed_data['recurrenceRule'] end |
#reference ⇒ String
Returns the reference of the payment.
22 23 24 |
# File 'lib/starling/resources/payment_resource.rb', line 22 def reference parsed_data['reference'] end |
#start_date ⇒ Date
Returns the start date of the payment.
56 57 58 |
# File 'lib/starling/resources/payment_resource.rb', line 56 def start_date present_date(parsed_data['startDate']) end |