-
Notifications
You must be signed in to change notification settings - Fork 6
Membership
Fetches all records for a given model, returns a CiscoSpark::Collection
Accepts any parameters that the API allows.
membership = CiscoSpark::Membership.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.
membership = CiscoSpark::Membership.fetch('Y2lzY...', options_hash)
=> #<CiscoSpark::Membership>
Creates a resource with given attributes, returns an instance Accepts any parameters that the API allows.
membership = CiscoSpark::Membership.create(person_id: 'Y2lzY...', room_id: 'Sd238f...')
=> #<CiscoSpark::Membership>
Updates a resource with given attributes, returns an instance Accepts any parameters that the API allows.
membership = CiscoSpark::Membership.update('Y2lzY...', is_moderator: true)
=> #<CiscoSpark::Membership>
Destroys a resource with the given ID, returns an boolean to indicate success Accepts any parameters that the API allows.
CiscoSpark::Membership.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" }]}'
membership = CiscoSpark::Membership.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" }'
membership = CiscoSpark::Membership.parse(json_string)
=> #<CiscoSpark::Membership>
Returns the person for this membership
Returns the room this membership belongs to
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
membership = CiscoSpark::Membership.new(person_id: 'Y2lzY...', room_id: 'Sd238f...')
membership.persist
=> #<CiscoSpark::Membership>
You can call fetch on an instance fetch or refresh an instance
membership = CiscoSpark::Membership.new(id: 'Y2lzY...')
membership.fetch
=> #<CiscoSpark::Membership>
You can call destroy on an instance to destroy it through the API
membership = CiscoSpark::Membership.new(id: 'Y2lzY...')
membership.destroy
=> true
Convert a model instance into a hash
membership = CiscoSpark::Membership.fetch('Y2lzY...')
membership.to_h
=> Hash