Class: TicketMaster::Provider::Zendesk::Project

Inherits:
Base::Project
  • Object
show all
Defined in:
lib/provider/project.rb

Overview

Project class for ticketmaster-zendesk

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*object) ⇒ Project

API = ZendeskAPI::Organization declare needed overloaded methods here



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/provider/project.rb', line 11

def initialize(*object)
  if object.first
    object = object.first
    unless object.is_a? Hash
      @system_data = {:client => object}
      hash = {:repository => object.,
              :user => object.username,
              :name => object.name}
    else
      hash = object
    end
    super hash
  end
end

Instance Attribute Details

#prefix_optionsObject

Returns the value of attribute prefix_options.



7
8
9
# File 'lib/provider/project.rb', line 7

def prefix_options
  @prefix_options
end

Instance Method Details

#copy(project) ⇒ Object

copy from this.copy(that) copies that into this



27
28
29
30
31
32
33
34
35
# File 'lib/provider/project.rb', line 27

def copy(project)
  project.tickets.each do |ticket|
    copy_ticket = self.ticket!(:title => ticket.title, :description => ticket.description)
    ticket.comments.each do |comment|
      copy_ticket.comment!(:body => comment.body)
      sleep 1
    end
  end
end

#ticket(*options) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/provider/project.rb', line 41

def ticket(*options)
  if options.first.is_a? Fixnum
    ticket_id = options.first
    Ticket.find_by_id(self.name, ticket_id)
  elsif options.first.is_a? Hash
    Ticket.find_by_attributes(self.name, options.first).first
  else
    TicketMaster::Provider::Zendesk::Ticket
  end
end

#ticket!(*options) ⇒ Object



52
53
54
# File 'lib/provider/project.rb', line 52

def ticket!(*options)
  Ticket.new ZendeskAPI::Ticket.create(options.first), self.name
end

#tickets(*options) ⇒ Object



37
38
39
# File 'lib/provider/project.rb', line 37

def tickets(*options)
  Ticket.find(self.name, options)
end