Class: Dropcam::NotificationBase

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

Direct Known Subclasses

Notification

Instance Attribute Summary collapse

Attributes inherited from Base

#cookies, #session_token

Instance Method Summary collapse

Methods inherited from Base

#get, #post

Constructor Details

#initialize(camera) ⇒ NotificationBase

Returns a new instance of NotificationBase.



7
8
9
# File 'lib/dropcam/notification_base.rb', line 7

def initialize(camera)
  @camera = camera
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#is_enabledObject

Returns the value of attribute is_enabled.



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

def is_enabled
  @is_enabled
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#delete(notifcation_id) ⇒ Object



24
25
26
27
# File 'lib/dropcam/notification_base.rb', line 24

def delete(notifcation_id)
  response = post(::CAMERA_DELETE_NOTIFICATION, {"id"=>notifcation_id}, @camera.cookies)      
  true
end

#devicesObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dropcam/notification_base.rb', line 11

def devices
  
  response = get(::CAMERA_FIND_NOTIFICATIONS, { "id" => @camera.uuid }, @camera.cookies)      
  notifications = []

  all_notifications = JSON.parse(response.body)["items"]
  all_notifications.each{|note|
    notifications.push Notification.new(@camera, note["target"])
  }
  
  notifications
end