Class: DPay::PayoutReceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/dpay/payout/payout_receiver.rb,
sig/dpay/payout/payout_receiver.rbs

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PayoutReceiver

Returns a new instance of PayoutReceiver.

Parameters:

  • data (Hash[String, untyped])


11
12
13
14
15
16
17
18
19
20
# File 'lib/dpay/payout/payout_receiver.rb', line 11

def initialize(data)
  @raw = data
  @nrb = data["nrb"].is_a?(String) ? data["nrb"] : nil
  @title = data["title"].is_a?(String) ? data["title"] : nil
  @amount = Money.try_from_api_number(data["amount"], Currency::PLN)
  @service = data["service"].is_a?(String) ? data["service"] : nil
  @receiver_name = data["receiverName"].is_a?(String) ? data["receiverName"] : nil
  @receiver_address = data["receiverAddress"].is_a?(String) ? data["receiverAddress"] : nil
  freeze
end

Instance Attribute Details

#amountMoney? (readonly)

Returns the value of attribute amount.

Returns:



5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def amount
  @amount
end

#nrbString? (readonly)

Returns the value of attribute nrb.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def nrb
  @nrb
end

#rawHash[String, untyped] (readonly)

Returns the value of attribute raw.

Returns:

  • (Hash[String, untyped])


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def raw
  @raw
end

#receiver_addressString? (readonly)

Returns the value of attribute receiver_address.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def receiver_address
  @receiver_address
end

#receiver_nameString? (readonly)

Returns the value of attribute receiver_name.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def receiver_name
  @receiver_name
end

#serviceString? (readonly)

Returns the value of attribute service.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def service
  @service
end

#titleString? (readonly)

Returns the value of attribute title.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/payout/payout_receiver.rb', line 5

def title
  @title
end

Class Method Details

.from_api(data) ⇒ PayoutReceiver

Parameters:

  • data (Hash[String, untyped])

Returns:



7
8
9
# File 'lib/dpay/payout/payout_receiver.rb', line 7

def self.from_api(data)
  new(data)
end