Class: Io::Flow::V0::Models::SettlementPayout

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

Instance Attribute Summary collapse

Attributes inherited from Settlement

#discriminator

Instance Method Summary collapse

Methods inherited from Settlement

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ SettlementPayout

Returns a new instance of SettlementPayout.



65731
65732
65733
65734
65735
65736
65737
65738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65731

def initialize(incoming={})
  super(:discriminator => Settlement::Types::SETTLEMENT_PAYOUT)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:status, :amount], 'SettlementPayout')
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::PayoutStatus) ? x : ::Io::Flow::V0::Models::PayoutStatus.from_json(x))
  @amount = HttpClient::Preconditions.assert_class('amount', HttpClient::Helper.to_big_decimal(opts.delete(:amount)), BigDecimal)
  @sent_on = (x = opts.delete(:sent_on); x.nil? ? nil : HttpClient::Preconditions.assert_class('sent_on', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



65729
65730
65731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65729

def amount
  @amount
end

#sent_onObject (readonly)

Returns the value of attribute sent_on.



65729
65730
65731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65729

def sent_on
  @sent_on
end

#statusObject (readonly)

Returns the value of attribute status.



65729
65730
65731
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65729

def status
  @status
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



65744
65745
65746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65744

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

#subtype_to_hashObject



65748
65749
65750
65751
65752
65753
65754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65748

def subtype_to_hash
  {
    :status => status.to_hash,
    :amount => amount.to_f.to_s,
    :sent_on => sent_on
  }
end

#to_jsonObject



65740
65741
65742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65740

def to_json
  JSON.dump(to_hash)
end