class Square::Connect::Refund

Attributes

created_at[RW]
identifier[RW]
payment[RW]
processed_at[RW]
reason[RW]
refunded_money[RW]
type[RW]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/square/connect/refund.rb, line 6
def initialize(attributes = {})
  self.identifier = attributes[:id]
  self.type = attributes[:type]
  self.reason = attributes[:reason]
  self.refunded_money = if attributes[:refunded_money]
    Money.new attributes[:refunded_money]
  end
  [
    :created_at,
    :processed_at
  ].each do |time_key|
    if attributes[time_key]
      self.send "#{time_key}=", Time.parse(attributes[time_key])
    end
  end
  self.payment = if attributes[:payment_id]
    Payment.new attributes[:payment_id]
  end
end