Class: ZendeskAPI::Ticket

Inherits:
Resource show all
Extended by:
CreateMany, DestroyMany, UpdateMany
Defined in:
lib/zendesk_api/resources.rb,
lib/zendesk_api/resources.rb

Defined Under Namespace

Classes: Audit, Comment, SatisfactionRating

Instance Attribute Summary

Attributes inherited from DataResource

#error, #error_message

Attributes inherited from Data

#association, #attributes, #errors, #response

Class Method Summary collapse

Methods included from CreateMany

create_many!

Methods included from UpdateMany

update_many!

Methods included from DestroyMany

destroy_many!

Methods included from Destroy

#destroy, #destroy!, #destroyed?, included

Methods included from Update

included

Methods included from Save

#clear_associations, #save, #save!, #save_associations

Methods included from ResponseHandler

#handle_response

Methods included from Create

included

Methods included from Read

included, #reload!

Methods included from Sideloading

included, #set_includes

Methods included from Verbs

#any, #delete, #post, #put

Methods inherited from Data

#==, #id, inherited, #initialize, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, resource_name, resource_path, singular_resource_name, subclasses, #to_json, #to_s

Methods included from Associations

included, #wrap_resource

Constructor Details

This class inherits a constructor from ZendeskAPI::Data

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data

Class Method Details

.import(client, attributes) ⇒ Ticket

Imports a ticket through the imports/tickets endpoint

Parameters:

  • client (Client)

    The Client object to be used

  • attributes (Hash)

    The attributes to create.

Returns:

  • (Ticket)

    Created object or nil



485
486
487
488
489
# File 'lib/zendesk_api/resources.rb', line 485

def self.import(client, attributes)
  ticket = new(client, attributes)
  return unless ticket.save(:path => "imports/tickets")
  ticket
end

.import!(client, attributes) ⇒ Ticket

Imports a ticket through the imports/tickets endpoint using save!

Parameters:

  • client (Client)

    The Client object to be used

  • attributes (Hash)

    The attributes to create.

Returns:

  • (Ticket)

    Created object or nil



475
476
477
478
479
# File 'lib/zendesk_api/resources.rb', line 475

def self.import!(client, attributes)
  new(client, attributes).tap do |ticket|
    ticket.save!(:path => "imports/tickets")
  end
end

.incremental_export(client, start_time) ⇒ Collection

Gets a incremental export of tickets from the start_time until now.

Parameters:

  • client (Client)

    The Client object to be used

  • start_time (Integer)

    The start_time parameter

Returns:



467
468
469
# File 'lib/zendesk_api/resources.rb', line 467

def self.incremental_export(client, start_time)
  ZendeskAPI::Collection.new(client, self, :path => "exports/tickets?start_time=#{start_time.to_i}")
end