Class: Io::Flow::V0::Models::VirtualCardRefund

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

A refund has been issued for the virtual credit card

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ VirtualCardRefund

Returns a new instance of VirtualCardRefund.



72564
72565
72566
72567
72568
72569
72570
72571
72572
72573
72574
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72564

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :issuer, :virtual_card, :authorization, :amount, :currency, :created_at], 'VirtualCardRefund')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @issuer = (x = opts.delete(:issuer); x.is_a?(::Io::Flow::V0::Models::IssuerV1) ? x : ::Io::Flow::V0::Models::IssuerV1.new(x))
  @virtual_card = (x = opts.delete(:virtual_card); x.is_a?(::Io::Flow::V0::Models::VirtualCardReference) ? x : ::Io::Flow::V0::Models::VirtualCardReference.new(x))
  @authorization = (x = opts.delete(:authorization); x.is_a?(::Io::Flow::V0::Models::AuthorizationReference) ? x : ::Io::Flow::V0::Models::AuthorizationReference.new(x))
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @created_at = HttpClient::Preconditions.assert_class('created_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:created_at)), DateTime)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def amount
  @amount
end

#authorizationObject (readonly)

Returns the value of attribute authorization.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def authorization
  @authorization
end

#created_atObject (readonly)

Returns the value of attribute created_at.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def id
  @id
end

#issuerObject (readonly)

Returns the value of attribute issuer.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def issuer
  @issuer
end

#virtual_cardObject (readonly)

Returns the value of attribute virtual_card.



72562
72563
72564
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72562

def virtual_card
  @virtual_card
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



72580
72581
72582
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72580

def copy(incoming={})
  VirtualCardRefund.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



72584
72585
72586
72587
72588
72589
72590
72591
72592
72593
72594
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72584

def to_hash
  {
    :id => id,
    :issuer => issuer.to_hash,
    :virtual_card => virtual_card.to_hash,
    :authorization => authorization.to_hash,
    :amount => amount.to_f.to_s,
    :currency => currency,
    :created_at => created_at
  }
end

#to_jsonObject



72576
72577
72578
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72576

def to_json
  JSON.dump(to_hash)
end