Class: Dropcam::Clip

Inherits:
ClipBase show all
Defined in:
lib/dropcam/clip.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#cookies, #session_token

Instance Method Summary collapse

Methods inherited from ClipBase

#all, #archive, #create

Methods inherited from Base

#delete, #get, #post

Constructor Details

#initialize(camera, properties = nil) ⇒ Clip

Returns a new instance of Clip.



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

def initialize(camera, properties = nil)
  super(camera)
  self.properties = properties
end

Instance Attribute Details

#camera_idObject (readonly)

Returns the value of attribute camera_id.



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

def camera_id
  @camera_id
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

#generated_timeObject (readonly)

Returns the value of attribute generated_time.



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

def generated_time
  @generated_time
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#is_errorObject (readonly)

Returns the value of attribute is_error.



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

def is_error
  @is_error
end

#length_in_secondsObject (readonly)

Returns the value of attribute length_in_seconds.



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

def length_in_seconds
  @length_in_seconds
end

#propertiesObject

Returns the value of attribute properties.



8
9
10
# File 'lib/dropcam/clip.rb', line 8

def properties
  @properties
end

Returns the value of attribute public_link.



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

def public_link
  @public_link
end

#serverObject (readonly)

Returns the value of attribute server.



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

def server
  @server
end

#start_timeObject (readonly)

Returns the value of attribute start_time.



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

def start_time
  @start_time
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#destroyObject

def title=(title)

return false unless @id
response = post(::CLIP_DELETE, { "id" => @id, "title" => title }, @camera.cookies)      
true

end



27
28
29
30
31
# File 'lib/dropcam/clip.rb', line 27

def destroy
  return false unless @id
  response = post(::CLIP_DELETE, { "id" => @id }, @camera.cookies)      
  true
end


33
34
35
# File 'lib/dropcam/clip.rb', line 33

def direct_link
  return "https://#{@server}/#{@filename}"
end


36
37
38
# File 'lib/dropcam/clip.rb', line 36

def direct_screenshot_link
  return "https://#{@server}/s3#{File.basename(@filename, File.extname(@filename))}.jpg"
end