Class: DoorList::Item

Inherits:
Object
  • Object
show all
Defined in:
app/models/door_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket, buyer) ⇒ Item

Returns a new instance of Item.



32
33
34
35
36
37
38
39
40
41
# File 'app/models/door_list.rb', line 32

def initialize(ticket, buyer)
  sold_item = ticket.sold_item

  self.ticket = ticket
  self.buyer = buyer
  self.special_instructions = ticket.special_instructions
  self.notes = ticket.notes
  self.payment_method = sold_item.try(:order).try(:payment_method)
  self.order_id = sold_item.try(:order).try(:id)
end

Instance Attribute Details

#buyerObject

Returns the value of attribute buyer.



20
21
22
# File 'app/models/door_list.rb', line 20

def buyer
  @buyer
end

#notesObject

Returns the value of attribute notes.



20
21
22
# File 'app/models/door_list.rb', line 20

def notes
  @notes
end

#order_idObject

Returns the value of attribute order_id.



20
21
22
# File 'app/models/door_list.rb', line 20

def order_id
  @order_id
end

#payment_methodObject

Returns the value of attribute payment_method.



20
21
22
# File 'app/models/door_list.rb', line 20

def payment_method
  @payment_method
end

#special_instructionsObject

Returns the value of attribute special_instructions.



20
21
22
# File 'app/models/door_list.rb', line 20

def special_instructions
  @special_instructions
end

#ticketObject

Returns the value of attribute ticket.



20
21
22
# File 'app/models/door_list.rb', line 20

def ticket
  @ticket
end

Instance Method Details

#<=>(obj) ⇒ Object



43
44
45
# File 'app/models/door_list.rb', line 43

def <=>(obj)
  (self.ticket.buyer.last_name.try(:downcase) || "") <=> (obj.ticket.buyer.last_name.try(:downcase) || "")
end