Class: TicketMaster::Provider::Github::Comment

Inherits:
Base::Comment
  • Object
show all
Defined in:
lib/provider/comment.rb

Overview

The comment class for ticketmaster-github

Do any mapping between Ticketmaster and your system’s comment model here versions of the ticket.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*options) ⇒ Comment

Returns a new instance of Comment.



11
12
13
14
15
16
17
18
19
20
# File 'lib/provider/comment.rb', line 11

def initialize(*options)
  if options.first.is_a? Hash
    object = options.first
    @system_data = {:client => object}
    object[:author] = object['user']
    object[:project_id] = options[1]
    object[:ticket_id] = options[2]
    super object
  end
end

Instance Attribute Details

#prefix_optionsObject

Returns the value of attribute prefix_options.



9
10
11
# File 'lib/provider/comment.rb', line 9

def prefix_options
  @prefix_options
end

Class Method Details

.create(project_id, ticket_id, comment) ⇒ Object



44
45
46
# File 'lib/provider/comment.rb', line 44

def self.create(project_id, ticket_id, comment)
  self.new TicketMaster::Provider::Github.api.add_comment("#{TicketMaster::Provider::Github.}/#{project_id}", ticket_id, comment)
end

.find(project_id, ticket_id) ⇒ Object

declare needed overloaded methods here



40
41
42
# File 'lib/provider/comment.rb', line 40

def self.find(project_id, ticket_id)
  TicketMaster::Provider::Github.api.issue_comments("#{TicketMaster::Provider::Github.}/#{project_id}", ticket_id).collect { |comment| self.new comment }
end

Instance Method Details

#created_atObject



22
23
24
25
26
27
28
# File 'lib/provider/comment.rb', line 22

def created_at
  @created_at ||= begin
    Time.parse(self[:created_at])
    rescue
    self[:created_at]
    end
end

#updated_atObject



30
31
32
33
34
35
36
# File 'lib/provider/comment.rb', line 30

def updated_at
  @updated_at ||= begin
    Time.parse(self[:updated_at])
    rescue
    self[:updated_at]
    end
end