Class: Dropcam::Screenshot

Inherits:
Base
  • Object
show all
Defined in:
lib/dropcam/screenshot.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#cookies, #session_token

Instance Method Summary collapse

Methods inherited from Base

#delete, #get, #post

Constructor Details

#initialize(camera) ⇒ Screenshot

Returns a new instance of Screenshot.



6
7
8
# File 'lib/dropcam/screenshot.rb', line 6

def initialize(camera)
  @camera = camera
end

Instance Attribute Details

#cameraObject

Returns the value of attribute camera.



5
6
7
# File 'lib/dropcam/screenshot.rb', line 5

def camera
  @camera
end

Instance Method Details

#current(width = 1200) ⇒ Object



10
11
12
# File 'lib/dropcam/screenshot.rb', line 10

def current(width=1200)
  return image_at_time(nil, width)
end

#image_at_time(timestamp, width = 1200) ⇒ Object



14
15
16
17
18
19
# File 'lib/dropcam/screenshot.rb', line 14

def image_at_time(timestamp, width=1200)
  params = {"uuid"=>@camera.uuid, "width" => width}
  params["time"] = timestamp if timestamp
  response = get(::NEXUS_GET_IMAGE_PATH, params, @camera.cookies, true)      
  return response.body
end