Class: Desk::Api::Cases

Inherits:
Object
  • Object
show all
Includes:
Creatable, Listable, Searchable
Defined in:
lib/desk/api/cases.rb

Constant Summary collapse

VALID_SEARCH_PARAMS =
[:name, :first_name, :last_name, :email, :phone,
:company, :twitter, :labels, :case_id, :subject,
:description, :status, :priority, :assigned_group,
:assigned_user, :channels, :notes, :attachments,
:case_custom_key, :created, :updated, :since_created_at,
:max_created_at, :since_updated_at, :max_updated_at,
:since_id, :max_id, :q]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Searchable

#search

Methods included from Creatable

#create, #update

Methods included from Listable

#all, #show

Constructor Details

#initialize(connection) ⇒ Cases

Returns a new instance of Cases.



26
27
28
29
30
# File 'lib/desk/api/cases.rb', line 26

def initialize(connection)
  @connection = connection
  @endpoint = "cases"
  @return_class = Desk::Case
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



24
25
26
# File 'lib/desk/api/cases.rb', line 24

def connection
  @connection
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



24
25
26
# File 'lib/desk/api/cases.rb', line 24

def endpoint
  @endpoint
end

#return_classObject (readonly)

Returns the value of attribute return_class.



24
25
26
# File 'lib/desk/api/cases.rb', line 24

def return_class
  @return_class
end

Instance Method Details

#message(id) ⇒ Object



32
33
34
# File 'lib/desk/api/cases.rb', line 32

def message(id)
  Desk::Message.new(connection.get("cases/#{id}/message"))
end

#replies(id) ⇒ Object



36
37
38
# File 'lib/desk/api/cases.rb', line 36

def replies(id)
  Desk::Message.new(connection.get("cases/#{id}/replies"))
end