Class: DPay::Refund

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Refund

Returns a new instance of Refund.

Parameters:

  • data (Hash[String, untyped])


11
12
13
14
15
16
# File 'lib/dpay/refund/refund.rb', line 11

def initialize(data)
  @raw = data
  @accepted = data["status"] == "success" && data["refund"] == true
  @message = Internal::Coerce.string(data["message"])
  freeze
end

Instance Attribute Details

#messageString? (readonly)

Returns the value of attribute message.

Returns:

  • (String, nil)


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

def message
  @message
end

#rawHash[String, untyped] (readonly)

Returns the value of attribute raw.

Returns:

  • (Hash[String, untyped])


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

def raw
  @raw
end

Class Method Details

.from_api(data) ⇒ Refund

Parameters:

  • data (Hash[String, untyped])

Returns:



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

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

Instance Method Details

#accepted?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/dpay/refund/refund.rb', line 18

def accepted?
  @accepted
end