class Square::Connect::Settlement

Attributes

bank_account[RW]
entries[RW]
initiated_at[RW]
status[RW]
total_money[RW]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Square::Connect::Node::new
# File lib/square/connect/settlement.rb, line 6
def initialize(*args)
  super do |attributes|
    self.status = attributes[:status]
    self.initiated_at = if attributes[:initiated_at]
      Time.parse attributes[:initiated_at]
    end
    self.bank_account = if attributes[:bank_account_id]
      BankAccount.new attributes[:bank_account_id], access_token
    end
    self.total_money = if attributes[:total_money]
      Money.new attributes[:total_money]
    end
    self.entries = Array(attributes[:entries]).collect do |entry_attributes|
      SettlementEntry.new entry_attributes
    end

    merchnat_id = attributes[:merchant_id] || :me
    self.endpoint = endpoint_for merchnat_id, :settlements, identifier
  end
end