Class: CapsuleCRM::Organisation

Inherits:
Party show all
Defined in:
lib/capsulecrm/organisation.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#id, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Party

#addresses, #custom_fields, #emails, find_all_by_email, find_by_email, get_path, #is?, #phone_numbers, search, #tag, #tag_names, #tags, #untag, #websites

Methods included from History

#add_history, #history, #history!

Methods inherited from Base

#==, #errors, find, #initialize, last_response, #new_record?

Constructor Details

This class inherits a constructor from CapsuleCRM::Base

Instance Attribute Details

#aboutObject

Returns the value of attribute about.



3
4
5
# File 'lib/capsulecrm/organisation.rb', line 3

def about
  @about
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/capsulecrm/organisation.rb', line 4

def name
  @name
end

Class Method Details

.init_many(response) ⇒ Object

nodoc



18
19
20
21
# File 'lib/capsulecrm/organisation.rb', line 18

def self.init_many(response)
  data = response['parties']['organisation']
  CapsuleCRM::Collection.new(self, data)
end

.init_one(response) ⇒ Object

nodoc



25
26
27
28
# File 'lib/capsulecrm/organisation.rb', line 25

def self.init_one(response)
  data = response['organisation']
  new(attributes_from_xml_hash(data))
end

.xml_mapObject

nodoc



32
33
34
35
36
37
38
# File 'lib/capsulecrm/organisation.rb', line 32

def self.xml_map
  map = {
    'about' => 'about',
    'name' => 'name'
  }
  super.merge map
end

Instance Method Details

#peopleObject

nodoc



8
9
10
11
12
13
14
# File 'lib/capsulecrm/organisation.rb', line 8

def people
  return @people if @people
  path = self.class.get_path
  path = [path, '/', id, '/people'].join
  last_response = self.class.get(path)
  @people = CapsuleCRM::Person.init_many(last_response)
end