Class: Starling::Resources::TransactionResource

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/starling/resources/transaction_resource.rb

Overview

A resource representing a Transaction returned from the Transactions API

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from Starling::Resources::BaseResource

Instance Method Details

#amountFloat

Returns the amount of the transaction.

Returns:

  • (Float)

    the amount of the transaction


16
17
18
# File 'lib/starling/resources/transaction_resource.rb', line 16

def amount
  present_float(parsed_data['amount'])
end

#createdTime Also known as: created_at

Returns the date and time when the transaction was recorded.

Returns:

  • (Time)

    the date and time when the transaction was recorded


26
27
28
# File 'lib/starling/resources/transaction_resource.rb', line 26

def created
  present_datetime(parsed_data['created'])
end

#currencyString

Returns the currency of the transaction (e.g. “GBP” or “UAH”).

Returns:

  • (String)

    the currency of the transaction (e.g. “GBP” or “UAH”)


11
12
13
# File 'lib/starling/resources/transaction_resource.rb', line 11

def currency
  parsed_data['currency']
end

#directionSymbol

Returns the direction of the transaction (e.g. `:outbound`).

Returns:

  • (Symbol)

    the direction of the transaction (e.g. `:outbound`)


21
22
23
# File 'lib/starling/resources/transaction_resource.rb', line 21

def direction
  present_enum(parsed_data['direction'])
end

#idString

Returns the Starling internal ID of the transaction.

Returns:

  • (String)

    the Starling internal ID of the transaction


6
7
8
# File 'lib/starling/resources/transaction_resource.rb', line 6

def id
  parsed_data['id']
end

#narrativeString

Returns the narrative of the transaction.

Returns:

  • (String)

    the narrative of the transaction


32
33
34
# File 'lib/starling/resources/transaction_resource.rb', line 32

def narrative
  parsed_data['narrative']
end

#sourceSymbol

Returns the source of the transaction (e.g. `:master_card`).

Returns:

  • (Symbol)

    the source of the transaction (e.g. `:master_card`)


37
38
39
# File 'lib/starling/resources/transaction_resource.rb', line 37

def source
  present_enum(parsed_data['source'])
end