Class: Dropcam::CuepointBase

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

Direct Known Subclasses

Cuepoint

Instance Attribute Summary

Attributes inherited from Base

#cookies, #session_token

Instance Method Summary collapse

Methods inherited from Base

#delete, #get, #post

Constructor Details

#initialize(camera) ⇒ CuepointBase

Returns a new instance of CuepointBase.



3
4
5
# File 'lib/dropcam/cuepoint_base.rb', line 3

def initialize(camera)
  @camera = camera
end

Instance Method Details

#all(limit = 2500) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/dropcam/cuepoint_base.rb', line 7

def all(limit=2500)
  params = {"uuid"=>@camera.uuid, "max_results"=>limit}
  response = get(::NEXUS_GET_REVERSE_PAGINATED_CUEPOINTS_PATH, params, @camera.cookies, true)      
  cuepoints = []
  all_cuepoints = JSON.parse(response.body)
  for cuepoint in all_cuepoints
    cuepoints.push Cuepoint.new(cuepoint)
  end
  cuepoints
end

#cuepoint(start_time) ⇒ Object



18
19
20
21
22
# File 'lib/dropcam/cuepoint_base.rb', line 18

def cuepoint(start_time)
  params = {"uuid"=>@camera.uuid, "start_time" => start_time}
  response = get(::NEXUS_GET_CUEPOINT_PATH, params, @camera.cookies, true)      
  Cuepoint.new(JSON.parse(response.body)[0])        
end