Class: Connectwise::Ticket
- Inherits:
-
Object
- Object
- Connectwise::Ticket
show all
- Includes:
- Model
- Defined in:
- lib/connectwise/ticket.rb
Instance Method Summary
collapse
Methods included from Model
#defined_attributes, included, #initialize, #persisted?, #to_h
Instance Method Details
#company=(company) ⇒ Object
23
24
25
|
# File 'lib/connectwise/ticket.rb', line 23
def company=(company)
@company = company
end
|
#destroy ⇒ Object
34
35
36
37
|
# File 'lib/connectwise/ticket.rb', line 34
def destroy
connection.call self.class.cw_api_name, "delete_#{self.class.cw_api_name}".to_sym, {SrServiceRecid: id}
self
end
|
#save ⇒ Object
27
28
29
30
31
32
|
# File 'lib/connectwise/ticket.rb', line 27
def save
return false unless @company
attrs = {companyId: @company.company_id, 'serviceTicket' => to_cw_h}
attrs = connection.call self.class.cw_api_name, "add_or_update_#{self.class.cw_api_name}_via_company_id".to_sym, attrs
self.class.new(connection, self.class.save_transform(attrs))
end
|
#status_name ⇒ Object
19
20
21
|
# File 'lib/connectwise/ticket.rb', line 19
def status_name
@status_name ||= 'New'
end
|