-
Notifications
You must be signed in to change notification settings - Fork 6
Person
Search all people by email,
people = CiscoSpark::Person.all_by_email('[email protected]', max: 5)
=> #<CiscoSpark::Collection>
Search all people by display name
people = CiscoSpark::Person.all_by_name('Nick', max: 5)
=> #<CiscoSpark::Collection>
Fetches all records for a given model, returns a CiscoSpark::Collection
Accepts any parameters that the API allows.
people = CiscoSpark::Person.fetch_all(max: 5)
=> #<CiscoSpark::Collection>
Fetches a single record for the given resource ID, returns an instance Accepts any parameters that the API allows.
person = CiscoSpark::Person.fetch('Y2lzY...', show_sip_address: true)
=> #<CiscoSpark::Person>
Creates a resource with given attributes, returns an instance Accepts any parameters that the API allows.
person = CiscoSpark::Person.create(title: 'Ruby Room')
=> #<CiscoSpark::Person>
Updates a resource with given attributes, returns an instance Accepts any parameters that the API allows.
person = CiscoSpark::Person.update('Y2lzY...', email: '[email protected]')
=> #<CiscoSpark::Person>
Destroys a resource with the given ID, returns an boolean to indicate success Accepts any parameters that the API allows.
room = CiscoSpark::Person.destroy('Y2lzY...')
=> true
Parses a valid JSON string or a ruby hash/array into a collection of models. This is useful for processing data received from a webhook etc.
json_string = '{"items": [{ "id": "Y2lzY...", "key": "value" }]}'
people = CiscoSpark::Person.parse_collection(json_string)
=> #<CiscoSpark::Collection>
Parses a valid JSON string or a ruby hash/array into a model. This is useful for processing data received from a webhook etc.
json_string = '{ "id": "Y2lzY...", "key": "value" }'
room = CiscoSpark::Person.parse(json_string)
=> #<CiscoSpark::Person>
Get all memberships for person
person = CiscoSpark::Person.new(id: 'Y2lz...')
person.memberships(max: 5)
=> #<CiscoSpark::Collection>
You can call persist on an instance to create or update it through the API.
If the instance already has an ID a PUT
will be made to update the mutable attributes
person = CiscoSpark::Person.new(email: '[email protected]')
person.persist
=> #<CiscoSpark::Person>
You can call fetch on an instance fetch or refresh an instance
person = CiscoSpark::Person.new(id: 'Y2lzY...')
person.fetch
=> #<CiscoSpark::Person>
You can call destroy on an instance to destroy it through the API
person = CiscoSpark::Person.new(id: 'Y2lzY...')
person.destroy
=> true
Convert a model instance into a hash
person = CiscoSpark::Person.fetch('Y2lzY...')
person.to_h
=> Hash