Module: Camper::Client::RecordingsAPI

Included in:
Camper::Client
Defined in:
lib/camper/api/recordings.rb

Overview

Defines methods related to recordings.

Instance Method Summary collapse

Instance Method Details

#archive_recording(recording) ⇒ Object

Archive a given recording

Examples:

client.archive_recording(my_todo)
client.archive_recording(my_message)

Parameters:

  • recording (Resource)

    a resource of a valid recording type

Raises:

See Also:



60
61
62
63
64
# File 'lib/camper/api/recordings.rb', line 60

def archive_recording(recording)
  raise Error::InvalidParameter, recording unless RecordingTypes.all.include?(recording.type)

  put("/buckets/#{recording.bucket.id}/recordings/#{recording.id}/status/archived")
end

#recordings(type, options = {}) ⇒ PaginatedResponse<Resource>

Get a paginated response of recordings of a given type

Examples:

client.recordings('Todo')
client.recordings(
  'Document',
  bucket: [1,2],
  status: 'archived',
  sort: 'updated_at',
  direction: 'asc'
)

Parameters:

  • type (String)

    type of the recording

  • options (Hash) (defaults to: {})

    extra options to filter the recordings to be resulted

Returns:

Raises:

See Also:



26
27
28
29
30
# File 'lib/camper/api/recordings.rb', line 26

def recordings(type, options = {})
  raise Error::InvalidParameter, type unless RecordingTypes.all.include?(type)

  get('/projects/recordings', query: options.merge(type: type))
end

#trash_recording(recording) ⇒ Object

Trash a given recording

Examples:

client.trash_recording(my_todo)
client.trash_recording(my_message)

Parameters:

  • recording (Resource)

    a resource of a valid recording type

Raises:

See Also:



43
44
45
46
47
# File 'lib/camper/api/recordings.rb', line 43

def trash_recording(recording)
  raise Error::InvalidParameter, recording unless RecordingTypes.all.include?(recording.type)

  put("/buckets/#{recording.bucket.id}/recordings/#{recording.id}/status/trashed")
end

#unarchive_recording(recording) ⇒ Object

Unarchive a given recording

Examples:

client.unarchive_recording(my_todo)
client.unarchive_recording(my_message)

Parameters:

  • recording (Resource)

    a resource of a valid recording type

Raises:

See Also:



77
78
79
80
81
# File 'lib/camper/api/recordings.rb', line 77

def unarchive_recording(recording)
  raise Error::InvalidParameter, recording unless RecordingTypes.all.include?(recording.type)

  put("/buckets/#{recording.bucket.id}/recordings/#{recording.id}/status/active")
end