Class: TortoiseLabs::Support::Ticket
- Inherits:
-
Object
- Object
- TortoiseLabs::Support::Ticket
- Defined in:
- lib/tortoiselabs/support.rb
Instance Attribute Summary collapse
-
#closed_at ⇒ Object
readonly
Returns the value of attribute closed_at.
-
#department ⇒ Object
readonly
Returns the value of attribute department.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#opened_at ⇒ Object
readonly
Returns the value of attribute opened_at.
-
#priority ⇒ Object
readonly
Returns the value of attribute priority.
-
#replies ⇒ Object
readonly
Returns the value of attribute replies.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
- .create(subject, message) ⇒ Object
-
.list ⇒ Object
Class Methods.
Instance Method Summary collapse
-
#close ⇒ Object
Instance Methods.
-
#initialize(thash) ⇒ Ticket
constructor
A new instance of Ticket.
- #open? ⇒ Boolean
- #reply(message) ⇒ Object
Constructor Details
#initialize(thash) ⇒ Ticket
Returns a new instance of Ticket.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tortoiselabs/support.rb', line 7 def initialize(thash) @closed_at, @department = thash["closed_at"], thash["department"] @opened_at, @priority = thash["opened_at"], thash["priority"] @subject, @user, @id = thash["subject"], thash["user"], thash["ticket"] @is_open = thash["is_open"] @replies = Array.new thash["replies"].each do |reply| obj = Reply.new(reply) @replies << obj end end |
Instance Attribute Details
#closed_at ⇒ Object (readonly)
Returns the value of attribute closed_at.
4 5 6 |
# File 'lib/tortoiselabs/support.rb', line 4 def closed_at @closed_at end |
#department ⇒ Object (readonly)
Returns the value of attribute department.
4 5 6 |
# File 'lib/tortoiselabs/support.rb', line 4 def department @department end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/tortoiselabs/support.rb', line 5 def id @id end |
#opened_at ⇒ Object (readonly)
Returns the value of attribute opened_at.
4 5 6 |
# File 'lib/tortoiselabs/support.rb', line 4 def opened_at @opened_at end |
#priority ⇒ Object (readonly)
Returns the value of attribute priority.
4 5 6 |
# File 'lib/tortoiselabs/support.rb', line 4 def priority @priority end |
#replies ⇒ Object (readonly)
Returns the value of attribute replies.
4 5 6 |
# File 'lib/tortoiselabs/support.rb', line 4 def replies @replies end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/tortoiselabs/support.rb', line 5 def subject @subject end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/tortoiselabs/support.rb', line 5 def user @user end |
Class Method Details
.create(subject, message) ⇒ Object
50 51 52 53 54 |
# File 'lib/tortoiselabs/support.rb', line 50 def self.create(subject, ) result = TortoiseLabs::Client.post("/support/ticket/new", {:subject => subject, :message => }) self.list end |
.list ⇒ Object
Class Methods
40 41 42 43 44 45 46 47 48 |
# File 'lib/tortoiselabs/support.rb', line 40 def self.list result = TortoiseLabs::Client.get("/support/tickets") tickets = Array.new JSON.parse(result)["tickets"].each do |tickethash| obj = Ticket.new(tickethash) tickets << obj end tickets end |
Instance Method Details
#close ⇒ Object
Instance Methods
23 24 25 26 |
# File 'lib/tortoiselabs/support.rb', line 23 def close result = TortoiseLabs::Client.get("/support/ticket/#{@id}/close") Ticket.list end |
#open? ⇒ Boolean
28 29 30 |
# File 'lib/tortoiselabs/support.rb', line 28 def open? @is_open end |
#reply(message) ⇒ Object
32 33 34 35 36 |
# File 'lib/tortoiselabs/support.rb', line 32 def reply() result = TortoiseLabs::Client.post("/support/ticket/#{@id}", {:message => }) Ticket.list end |