class Connectwise::TicketNote

Attributes

id[RW]
is_part_of_detail_description[RW]
is_part_of_internal_analysis[RW]
is_part_of_resolution[RW]
note[RW]
note_text[RW]

Public Class Methods

cw_api_name() click to toggle source
# File lib/connectwise/ticket_note.rb, line 7
def self.cw_api_name
  :service_ticket
end
new(connection, **attributes) click to toggle source
Calls superclass method Connectwise::Model::new
# File lib/connectwise/ticket_note.rb, line 24
def initialize(connection, **attributes)
  @ticket = attributes.delete(:ticket)
  super(connection, attributes)
end
transform(attrs) click to toggle source
# File lib/connectwise/ticket_note.rb, line 11
def self.transform(attrs)
  type = attrs.delete(:type)
  attrs[:note_text] ||= attrs.delete(:note)
  if type == :internal
    attrs[:is_part_of_internal_analysis] = true
  elsif type == :resolution
    attrs[:is_part_of_resolution] = true
  else
    attrs[:is_part_of_detail_description] = true
  end
  attrs
end

Public Instance Methods

external?() click to toggle source
# File lib/connectwise/ticket_note.rb, line 34
def external?
  !!is_part_of_detail_description
end
internal?() click to toggle source
# File lib/connectwise/ticket_note.rb, line 38
def internal?
  !!is_part_of_internal_analysis
end
resolution?() click to toggle source
# File lib/connectwise/ticket_note.rb, line 42
def resolution?
  !!is_part_of_resolution
end
save() click to toggle source
# File lib/connectwise/ticket_note.rb, line 29
def save
  attrs = connection.call self.class.cw_api_name, "update_#{self.class.cw_model_name}".to_sym, {'note' => to_cw_h, 'srServiceRecid' => @ticket.id}
  self.class.new(connection, self.class.save_transform(attrs))
end