Class: DPay::RefundAvailability

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, http_status = nil) ⇒ RefundAvailability

Returns a new instance of RefundAvailability.

Parameters:

  • data (Hash[String, untyped])
  • http_status (Integer, nil) (defaults to: nil)


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

def initialize(data, http_status = nil)
  @raw = data
  @available = data["refund"] == true
  @message = Internal::Coerce.string(data["message"])
  @http_status = http_status
  freeze
end

Instance Attribute Details

#http_statusInteger? (readonly)

Returns the value of attribute http_status.

Returns:

  • (Integer, nil)


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

def http_status
  @http_status
end

#messageString? (readonly)

Returns the value of attribute message.

Returns:

  • (String, nil)


5
6
7
# File 'lib/dpay/refund/refund_availability.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_availability.rb', line 5

def raw
  @raw
end

Class Method Details

.from_api(data, http_status = nil) ⇒ RefundAvailability

Parameters:

  • data (Hash[String, untyped])
  • http_status (Integer, nil) (defaults to: nil)

Returns:



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

def self.from_api(data, http_status = nil)
  new(data, http_status)
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


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

def available?
  @available
end