Class: Ticket

Inherits:
Object show all
Defined in:
lib/ticket.rb

Overview

This program allows you to use command line to perform your typical assembla.com tasks. USing it you can check for new tickets, change status, reasign them or create new ones

Author

Ignacy Moryc ([email protected])

License

MIT

This is the ticket class responsible for describing the ticket object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, summary, status, assigned_to) ⇒ Ticket

:nodoc:



14
15
16
17
18
19
# File 'lib/ticket.rb', line 14

def initialize(id, summary, status, assigned_to) #:nodoc:
  self.id = id.to_i
  self.summary = summary
  self.status = status
  self.assigned_to = assigned_to
end

Instance Attribute Details

#assigned_toObject

Returns the value of attribute assigned_to.



12
13
14
# File 'lib/ticket.rb', line 12

def assigned_to
  @assigned_to
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/ticket.rb', line 12

def id
  @id
end

#statusObject

Returns the value of attribute status.



12
13
14
# File 'lib/ticket.rb', line 12

def status
  @status
end

#summaryObject

Returns the value of attribute summary.



12
13
14
# File 'lib/ticket.rb', line 12

def summary
  @summary
end

Instance Method Details

#detailsObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ticket.rb', line 25

def details
  details = <<DETAILS
Id:          #{self.id}
Status:      #{self.status.to_s}
AssignedTo:  #{self.assigned_to}
-----------------------------------------------
Sumary:      #{self.summary}
-----------------------------------------------
DETAILS
  
  
end

#to_sObject

:nodoc:



21
22
23
# File 'lib/ticket.rb', line 21

def to_s #:nodoc:
  "#{self.id.to_s.center(5)}|#{self.assigned_to.center(18)}|#{self.status.to_s.center(10)}| #{self.summary} \n"
end