Class: OmnivoreIO::Ticket

Inherits:
Object
  • Object
show all
Includes:
OmnivoreObject
Defined in:
lib/omnivore-io/api/ticket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OmnivoreObject

included

Constructor Details

#initialize(client, attributes = {}) ⇒ Ticket

Returns a new instance of Ticket.



9
10
11
12
13
14
15
16
17
# File 'lib/omnivore-io/api/ticket.rb', line 9

def initialize(client, attributes={})
  self.client = client
  self.items = []
  attributes.each do |key, value|
    if self.respond_to? "#{key}=".to_sym
      self.send "#{key}=".to_sym, value
    end
  end
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



5
6
7
# File 'lib/omnivore-io/api/ticket.rb', line 5

def client
  @client
end

#itemsObject

Returns the value of attribute items.



5
6
7
# File 'lib/omnivore-io/api/ticket.rb', line 5

def items
  @items
end

Instance Method Details

#open!Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/omnivore-io/api/ticket.rb', line 19

def open!
  payload = {
    "employee" => self.employee,
    "order_type" => self.order_type,
    "revenue_center" => self.revenue_center,
    "guest_count" => self.guest_count,
    "name" => self.name,
    "auto_send" => self.auto_send
  }
  self.merge! self.client.open_ticket(self.location_id, payload)
end