Class: CapsuleCRM::Person
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations, Contactable, CapsuleCRM::Persistence::Deletable, CapsuleCRM::Persistence::Persistable, Querying::Configuration, Serializable
- Defined in:
- lib/capsule_crm/person.rb
Class Method Summary collapse
-
.all(options = {}) ⇒ Object
Public: Get all people from Capsule.
- .first ⇒ Object
Methods included from Serializable
included, #serializer, #to_capsule_json
Methods included from Querying::Configuration
Methods included from CapsuleCRM::Persistence::Deletable
Methods included from CapsuleCRM::Persistence::Persistable
#build_create_path, #build_update_path, #create_record, included, #new_record?, #persisted?, #save, #save!, #update_attributes, #update_attributes!, #update_record
Methods included from Contactable
Methods included from Taggable
#add_tag, #api_singular_name, #remove_tag, #tags
Methods included from Querying::Findable
Methods included from Inspector
Class Method Details
.all(options = {}) ⇒ Object
Public: Get all people from Capsule. The list can be restricted and/or paginated with various query parameters sent through the options hash.
options - The Hash of allowed query parameters for Capsule (default: {}):
:q - The String search term that will be matched against
name,
:tag - The String tag to search for
:start - The Integer first record to be returned in
pagination.
The results start with an index of 1
:limit - The Integer maximum number of matching records to be
returned
Examples
CapsuleCRM::Organization.all
CapsuleCRM::Organization.all(q: “a search query”, start: 10, limit: 20)
Returns a ResultsProxy of organisations
64 65 66 67 |
# File 'lib/capsule_crm/person.rb', line 64 def self.all( = {}) CapsuleCRM::Party.all(). delete_if { |item| !item.is_a?(CapsuleCRM::Person) } end |
.first ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/capsule_crm/person.rb', line 69 def self.first raise NotImplementedError.new( [ 'Unfortunately the capsulecrm.com API returns people and', 'organizations in one response. There is no way to query directly', 'for people. This means that quite often the first item returned', 'will actually be an organization and so CapsuleCRM::Person.first is', 'not possible.' ].join(' ') ) end |