Class: Dropcam::Camera

Inherits:
Base
  • Object
show all
Defined in:
lib/dropcam/camera.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(uuid, properties = {}) ⇒ Camera

Returns a new instance of Camera.



21
22
23
24
25
# File 'lib/dropcam/camera.rb', line 21

def initialize(uuid, properties={})
  @uuid = uuid
  @settings = {}
  self.properties = properties
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def description
  @description
end

#download_hostObject (readonly)

Returns the value of attribute download_host.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def download_host
  @download_host
end

#download_server_liveObject (readonly)

Returns the value of attribute download_server_live.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def download_server_live
  @download_server_live
end

#hours_of_recording_maxObject (readonly)

Returns the value of attribute hours_of_recording_max.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def hours_of_recording_max
  @hours_of_recording_max
end

#idObject (readonly)

Returns the value of attribute id.



17
18
19
# File 'lib/dropcam/camera.rb', line 17

def id
  @id
end

#is_connectedObject (readonly)

Returns the value of attribute is_connected.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def is_connected
  @is_connected
end

#is_onlineObject (readonly)

Returns the value of attribute is_online.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def is_online
  @is_online
end

#is_publicObject (readonly)

Returns the value of attribute is_public.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def is_public
  @is_public
end

#is_streamingObject (readonly)

Returns the value of attribute is_streaming.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def is_streaming
  @is_streaming
end

#notification_devicesObject (readonly)

Returns the value of attribute notification_devices.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def notification_devices
  @notification_devices
end

#owner_idObject (readonly)

Returns the value of attribute owner_id.



17
18
19
# File 'lib/dropcam/camera.rb', line 17

def owner_id
  @owner_id
end

#public_tokenObject (readonly)

Returns the value of attribute public_token.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def public_token
  @public_token
end

#settings(force = false) ⇒ Object

Returns the value of attribute settings.



18
19
20
# File 'lib/dropcam/camera.rb', line 18

def settings
  @settings
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def timezone
  @timezone
end

#timezone_utc_offsetObject (readonly)

Returns the value of attribute timezone_utc_offset.



16
17
18
# File 'lib/dropcam/camera.rb', line 16

def timezone_utc_offset
  @timezone_utc_offset
end

#titleObject (readonly)

Returns the value of attribute title.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def title
  @title
end

#typeObject (readonly)

Returns the value of attribute type.



17
18
19
# File 'lib/dropcam/camera.rb', line 17

def type
  @type
end

#uuidObject (readonly)

Returns the value of attribute uuid.



15
16
17
# File 'lib/dropcam/camera.rb', line 15

def uuid
  @uuid
end

Instance Method Details

#clipObject



56
57
58
59
# File 'lib/dropcam/camera.rb', line 56

def clip
  @clip_base = ClipBase.new(self) unless @clip_base
  @clip_base
end

#cuepointObject



60
61
62
63
# File 'lib/dropcam/camera.rb', line 60

def cuepoint
  @cuepoint_base = CuepointBase.new(self) unless @cuepoint_base
  @cuepoint_base
end

#notificationObject



70
71
72
73
# File 'lib/dropcam/camera.rb', line 70

def notification
  @notification = NotifcationBase.new(self) unless @notification
  @notification
end

#properties=(properties) ⇒ Object



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

def properties=(properties)
  properties.each{|key, value|
    instance_variable_set("@#{key}", value)
  }
end

#public=(is_public) ⇒ Object



84
85
86
87
# File 'lib/dropcam/camera.rb', line 84

def public=(is_public)
  response = post(::CAMERAS_UPDATE, {"uuid"=>@uuid, "is_public"=>is_public, "accepted_public_terms_at" => "true"}, @cookies)      
  self.properties = JSON.parse(response.body)["items"][0]
end

#public?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/dropcam/camera.rb', line 89

def public?
  @is_public
end

#screenshotObject



51
52
53
54
# File 'lib/dropcam/camera.rb', line 51

def screenshot
  @screenshot = Screenshot.new(self) unless @screenshot
  @screenshot
end

#set_public_token(token) ⇒ Object



93
94
95
96
97
# File 'lib/dropcam/camera.rb', line 93

def set_public_token(token)
  response = post(::CAMERAS_UPDATE, {"uuid"=>@uuid, "token"=>token}, @cookies)      
  self.properties = JSON.parse(response.body)["items"][0]
  true
end

#streamObject



65
66
67
68
# File 'lib/dropcam/camera.rb', line 65

def stream
  @stream = Stream.new(self) unless @stream
  @stream
end

#update_infoObject



76
77
78
79
80
# File 'lib/dropcam/camera.rb', line 76

def update_info
  response = get(::CAMERAS_GET, {"id"=>@uuid}, @cookies)      
  self.properties = JSON.parse(response.body)["items"][0]

end