Class: Square::Connect::Tender

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Tender

Returns a new instance of Tender.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/square/connect/tender.rb', line 6

def initialize(attributes = {})
  self.type = attributes[:type]
  self.name = attributes[:name]
  self.card_brand = attributes[:card_brand]
  self.pan_suffix = attributes[:pan_suffix]
  self.entry_method = attributes[:entry_method]
  self.payment_note = attributes[:payment_note]
  [
    :total_money,
    :tendered_money,
    :change_back_money
  ].each do |money_attr|
    if attributes[money_attr]
      self.send "#{money_attr}=", Money.new(attributes[money_attr])
    end
  end
end

Instance Attribute Details

#card_brandObject

Returns the value of attribute card_brand.



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

def card_brand
  @card_brand
end

#change_back_moneyObject

Returns the value of attribute change_back_money.



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

def change_back_money
  @change_back_money
end

#entry_methodObject

Returns the value of attribute entry_method.



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

def entry_method
  @entry_method
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#pan_suffixObject

Returns the value of attribute pan_suffix.



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

def pan_suffix
  @pan_suffix
end

#payment_noteObject

Returns the value of attribute payment_note.



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

def payment_note
  @payment_note
end

#tendered_moneyObject

Returns the value of attribute tendered_money.



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

def tendered_money
  @tendered_money
end

#total_moneyObject

Returns the value of attribute total_money.



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

def total_money
  @total_money
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end