Class: Dropcam::Clip
- Inherits:
-
Object
- Object
- Dropcam::Clip
- Defined in:
- lib/dropcam/clip.rb
Instance Attribute Summary collapse
-
#camera_id ⇒ Object
readonly
Returns the value of attribute camera_id.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#generated_time ⇒ Object
readonly
Returns the value of attribute generated_time.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_error ⇒ Object
readonly
Returns the value of attribute is_error.
-
#length_in_seconds ⇒ Object
readonly
Returns the value of attribute length_in_seconds.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#public_link ⇒ Object
readonly
Returns the value of attribute public_link.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #delete ⇒ Object
- #direct_link ⇒ Object
- #direct_screenshot_link ⇒ Object
-
#initialize(camera, properties = nil) ⇒ Clip
constructor
A new instance of Clip.
- #set_title(title) ⇒ Object
Constructor Details
#initialize(camera, properties = nil) ⇒ Clip
Returns a new instance of Clip.
7 8 9 10 |
# File 'lib/dropcam/clip.rb', line 7 def initialize(camera, properties = nil) @camera = camera self.properties = properties end |
Instance Attribute Details
#camera_id ⇒ Object (readonly)
Returns the value of attribute camera_id.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def camera_id @camera_id end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def description @description end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/dropcam/clip.rb', line 4 def filename @filename end |
#generated_time ⇒ Object (readonly)
Returns the value of attribute generated_time.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def generated_time @generated_time end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def id @id end |
#is_error ⇒ Object (readonly)
Returns the value of attribute is_error.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def is_error @is_error end |
#length_in_seconds ⇒ Object (readonly)
Returns the value of attribute length_in_seconds.
4 5 6 |
# File 'lib/dropcam/clip.rb', line 4 def length_in_seconds @length_in_seconds end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/dropcam/clip.rb', line 6 def properties @properties end |
#public_link ⇒ Object (readonly)
Returns the value of attribute public_link.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def public_link @public_link end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def server @server end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def start_time @start_time end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/dropcam/clip.rb', line 3 def title @title end |
Instance Method Details
#delete ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/dropcam/clip.rb', line 39 def delete return false unless @id response = post(::CLIP_DELETE, { "id" => @id }, @cookies) if response.success? return true elsif response. raise AuthorizationError else raise CameraNotFoundError end end |
#direct_link ⇒ Object
19 20 21 |
# File 'lib/dropcam/clip.rb', line 19 def direct_link return "https://#{@server}/#{@filename}" end |
#direct_screenshot_link ⇒ Object
22 23 24 |
# File 'lib/dropcam/clip.rb', line 22 def direct_screenshot_link return "https://#{@server}/s3#{File.basename(@filename, File.extname(@filename))}.jpg" end |
#set_title(title) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/dropcam/clip.rb', line 26 def set_title(title) return false unless @id response = post(::CLIP_DELETE, { "id" => @id, "title" => title }, @cookies) if response.success? return true elsif response. raise AuthorizationError else raise CameraNotFoundError end end |