Class: Connectwise::TicketNote
- Inherits:
-
Object
- Object
- Connectwise::TicketNote
- Includes:
- Model
- Defined in:
- lib/connectwise/ticket_note.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_part_of_detail_description ⇒ Object
Returns the value of attribute is_part_of_detail_description.
-
#is_part_of_internal_analysis ⇒ Object
Returns the value of attribute is_part_of_internal_analysis.
-
#is_part_of_resolution ⇒ Object
Returns the value of attribute is_part_of_resolution.
-
#note ⇒ Object
Returns the value of attribute note.
-
#note_text ⇒ Object
Returns the value of attribute note_text.
Class Method Summary collapse
Instance Method Summary collapse
- #external? ⇒ Boolean
-
#initialize(connection, **attributes) ⇒ TicketNote
constructor
A new instance of TicketNote.
- #internal? ⇒ Boolean
- #resolution? ⇒ Boolean
- #save ⇒ Object
Methods included from Model
#defined_attributes, #destroy, included, #persisted?, #to_cw_h, #to_h
Constructor Details
#initialize(connection, **attributes) ⇒ TicketNote
Returns a new instance of TicketNote.
24 25 26 27 |
# File 'lib/connectwise/ticket_note.rb', line 24 def initialize(connection, **attributes) @ticket = attributes.delete(:ticket) super(connection, attributes) end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def id @id end |
#is_part_of_detail_description ⇒ Object
Returns the value of attribute is_part_of_detail_description.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def is_part_of_detail_description @is_part_of_detail_description end |
#is_part_of_internal_analysis ⇒ Object
Returns the value of attribute is_part_of_internal_analysis.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def is_part_of_internal_analysis @is_part_of_internal_analysis end |
#is_part_of_resolution ⇒ Object
Returns the value of attribute is_part_of_resolution.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def is_part_of_resolution @is_part_of_resolution end |
#note ⇒ Object
Returns the value of attribute note.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def note @note end |
#note_text ⇒ Object
Returns the value of attribute note_text.
5 6 7 |
# File 'lib/connectwise/ticket_note.rb', line 5 def note_text @note_text end |
Class Method Details
.cw_api_name ⇒ Object
7 8 9 |
# File 'lib/connectwise/ticket_note.rb', line 7 def self.cw_api_name :service_ticket end |
.transform(attrs) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 |
Instance Method Details
#external? ⇒ Boolean
34 35 36 |
# File 'lib/connectwise/ticket_note.rb', line 34 def external? !!is_part_of_detail_description end |
#internal? ⇒ Boolean
38 39 40 |
# File 'lib/connectwise/ticket_note.rb', line 38 def internal? !!is_part_of_internal_analysis end |
#resolution? ⇒ Boolean
42 43 44 |
# File 'lib/connectwise/ticket_note.rb', line 42 def resolution? !!is_part_of_resolution end |
#save ⇒ Object
29 30 31 32 |
# 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 |