Class: Desk::Api::Companies

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

Constant Summary collapse

VALID_SEARCH_PARAMS =
[: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) ⇒ Companies

Returns a new instance of Companies.



18
19
20
21
22
# File 'lib/desk/api/companies.rb', line 18

def initialize(connection)
  @connection = connection
  @endpoint = "companies"
  @return_class = Desk::Company
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



16
17
18
# File 'lib/desk/api/companies.rb', line 16

def connection
  @connection
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



16
17
18
# File 'lib/desk/api/companies.rb', line 16

def endpoint
  @endpoint
end

#return_classObject (readonly)

Returns the value of attribute return_class.



16
17
18
# File 'lib/desk/api/companies.rb', line 16

def return_class
  @return_class
end

Instance Method Details

#cases(id) ⇒ Object



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

def cases(id)
  Desk::Collection.new(connection.get("companies/#{id}/cases"), Desk::Case)
end