Class: Square::Connect::Refund

Inherits:
Object
  • Object
show all
Defined in:
lib/square/connect/refund.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Refund

Returns a new instance of Refund.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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

Instance Attribute Details

#created_atObject

Returns the value of attribute created_at.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def created_at
  @created_at
end

#identifierObject

Returns the value of attribute identifier.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def identifier
  @identifier
end

#paymentObject

Returns the value of attribute payment.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def payment
  @payment
end

#processed_atObject

Returns the value of attribute processed_at.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def processed_at
  @processed_at
end

#reasonObject

Returns the value of attribute reason.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def reason
  @reason
end

#refunded_moneyObject

Returns the value of attribute refunded_money.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def refunded_money
  @refunded_money
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/square/connect/refund.rb', line 4

def type
  @type
end