Class: Eyeson::Snapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/eyeson/snapshot.rb

Overview

Get room snapshots

Defined Under Namespace

Classes: NotFound

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, url) ⇒ Snapshot

Returns a new instance of Snapshot.



9
10
11
12
# File 'lib/eyeson/snapshot.rb', line 9

def initialize(id, url)
  @id = id
  @url = url
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/eyeson/snapshot.rb', line 7

def id
  @id
end

#urlObject (readonly)

Returns the value of attribute url.



7
8
9
# File 'lib/eyeson/snapshot.rb', line 7

def url
  @url
end

Class Method Details

.find(snapshot_id) ⇒ Object

Raises:



18
19
20
21
22
23
# File 'lib/eyeson/snapshot.rb', line 18

def self.find(snapshot_id)
  response = Eyeson.get("/snapshots/#{snapshot_id}")
  links    = response['links']
  raise NotFound if links.nil?
  Snapshot.new snapshot_id, links['download']
end

Instance Method Details

#deleteObject



14
15
16
# File 'lib/eyeson/snapshot.rb', line 14

def delete
  Eyeson.delete "/snapshots/#{id}"
end