class ZendeskAPI::Ticket

@internal The following are redefined later, but needed by some circular resources (e.g. Ticket -> User, User -> Ticket)

Public Class Methods

cbp_path_regexes() click to toggle source
# File lib/zendesk_api/resources.rb, line 465
def self.cbp_path_regexes
  [/^tickets$/, %r{organizations/\d+/tickets}, %r{users/\d+/tickets/requested}]
end
import(client, attributes) click to toggle source

Imports a ticket through the imports/tickets endpoint @param [Client] client The {Client} object to be used @param [Hash] attributes The attributes to create. @return [Ticket] Created object or nil

# File lib/zendesk_api/resources.rb, line 569
def self.import(client, attributes)
  ticket = new(client, attributes)
  return unless ticket.save(path: "imports/tickets")
  ticket
end
import!(client, attributes) click to toggle source

Imports a ticket through the imports/tickets endpoint using save! @param [Client] client The {Client} object to be used @param [Hash] attributes The attributes to create. @return [Ticket] Created object or nil

# File lib/zendesk_api/resources.rb, line 559
def self.import!(client, attributes)
  new(client, attributes).tap do |ticket|
    ticket.save!(path: "imports/tickets")
  end
end
incremental_export(client, start_time) click to toggle source

Gets a incremental export of tickets from the start_time until now. @param [Client] client The {Client} object to be used @param [Integer] start_time The start_time parameter @return [Collection] Collection of {Ticket}

# File lib/zendesk_api/resources.rb, line 551
def self.incremental_export(client, start_time)
  ZendeskAPI::Collection.new(client, self, path: "incremental/tickets?start_time=#{start_time.to_i}")
end

Public Instance Methods

attribute_changes() click to toggle source

Unlike other attributes, “comment” is not a property of the ticket, but is used as a “comment on save”, so it should be kept unchanged, See github.com/zendesk/zendesk_api_client_rb/issues/321

# File lib/zendesk_api/resources.rb, line 472
def attribute_changes
  attributes.changes.merge("comment" => attributes["comment"])
end
to_param() click to toggle source
# File lib/zendesk_api/resources.rb, line 525
def to_param
  map(&:id)
end