Class: CloudRailSi::Types::Refund

Inherits:
SandboxObject show all
Defined in:
lib/cloudrail_si/types/Refund.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SandboxObject

#get, #set

Constructor Details

#initialize(amount, charge_id, created, id, state, currency) ⇒ Refund

Returns a new instance of Refund.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/cloudrail_si/types/Refund.rb', line 9

def initialize(amount, charge_id, created, id, state, currency)
    super()
    @amount = amount
    @charge_id = charge_id
    @created = created
    @id = id
    @state = state
    @currency = currency
    raise Errors::IllegalArgumentError.new("At least one of the parameters is nil.") if (charge_id.nil? || id.nil? || state.nil?)
    raise Errors::IllegalArgumentError.new("Unknown state. Allowed values are: 'succeeded', 'failed' or 'pending'.") if (["pending", "succeeded", "failed"].index(@state) < 0)
    raise Errors::IllegalArgumentError.new("The passed currency is invalid.") if (@currency.length != 3)

    @currency = @currency.upcase
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def amount
  @amount
end

#charge_idObject (readonly)

Returns the value of attribute charge_id.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def charge_id
  @charge_id
end

#createdObject (readonly)

Returns the value of attribute created.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def created
  @created
end

#currencyObject (readonly)

Returns the value of attribute currency.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def id
  @id
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/cloudrail_si/types/Refund.rb', line 7

def state
  @state
end