Class: Sdp::Transfer

Inherits:
Struct
  • Object
show all
Defined in:
lib/sdp/resources/payments.rb

Overview

A transfer as SDP reports it. SDP omits optional fields entirely —source/destination/amount/memo can be ABSENT from the JSON, not null —so every member is nil when SDP didn’t send it.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#amountObject

Returns the value of attribute amount

Returns:

  • (Object)

    the current value of amount



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def amount
  @amount
end

#created_atObject

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def created_at
  @created_at
end

#destinationObject

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def destination
  @destination
end

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def direction
  @direction
end

#errorObject

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def error
  @error
end

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def id
  @id
end

#memoObject

Returns the value of attribute memo

Returns:

  • (Object)

    the current value of memo



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def memo
  @memo
end

#signatureObject

Returns the value of attribute signature

Returns:

  • (Object)

    the current value of signature



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def signature
  @signature
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def source
  @source
end

#statusObject

Returns the value of attribute status

Returns:

  • (Object)

    the current value of status



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def status
  @status
end

#tokenObject

Returns the value of attribute token

Returns:

  • (Object)

    the current value of token



9
10
11
# File 'lib/sdp/resources/payments.rb', line 9

def token
  @token
end

Class Method Details

.from_hash(hash) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sdp/resources/payments.rb', line 12

def self.from_hash(hash)
  hash ||= {}
  new(
    id: hash[:id],
    direction: hash[:direction],
    status: hash[:status],
    signature: hash[:signature],
    token: hash[:token],
    amount: hash[:amount],
    source: hash[:source],
    destination: hash[:destination],
    memo: hash[:memo],
    error: hash[:error],
    created_at: hash[:created_at]
  )
end