class TicketSharing::Ticket
Attributes
agreement[RW]
response[R]
Public Class Methods
parse(json)
click to toggle source
# File lib/ticket_sharing/ticket.rb, line 17 def self.parse(json) attributes = JsonSupport.decode(json) ticket = new(attributes) if ticket.requester ticket.requester = Actor.new(ticket.requester) end if ticket.current_actor ticket.current_actor = Actor.new(ticket.current_actor) end if ticket.comments ticket.comments = ticket.comments.map { |comment| Comment.new(comment) } end ticket end
Public Instance Methods
comments()
click to toggle source
# File lib/ticket_sharing/ticket.rb, line 41 def comments @comments ||= [] end
relative_url()
click to toggle source
# File lib/ticket_sharing/ticket.rb, line 68 def relative_url "/tickets/#{uuid}" end
requested_at=(val)
click to toggle source
TSTODO make all of these setters behave this way, not like they do in parse
# File lib/ticket_sharing/ticket.rb, line 37 def requested_at=(val) @requested_at = TicketSharing::Time.new(val) end
send_to(url)
click to toggle source
# File lib/ticket_sharing/ticket.rb, line 45 def send_to(url) raise "Agreement not present" unless agreement client = Client.new(url, agreement.authentication_token) @response = client.post(relative_url, self.to_json) @response.status end
update_partner(url)
click to toggle source
# File lib/ticket_sharing/ticket.rb, line 54 def update_partner(url) client = Client.new(url, agreement.authentication_token) @response = client.put(relative_url, self.to_json) @response.status end