Class: Dropcam::Dropcam
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Attributes inherited from Base
Instance Method Summary collapse
- #camera(uuid) ⇒ Object
- #cameras ⇒ Object
- #get_public_camera(token) ⇒ Object
-
#initialize(username, password) ⇒ Dropcam
constructor
A new instance of Dropcam.
- #public_cameras ⇒ Object
Methods inherited from Base
Constructor Details
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
8 9 10 |
# File 'lib/dropcam.rb', line 8 def session @session end |
Instance Method Details
#camera(uuid) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/dropcam.rb', line 14 def camera(uuid) c = Camera.new(uuid) c. = @session. c.session_token = @session.session_token c.update_info c end |
#cameras ⇒ Object
34 35 36 37 38 39 |
# File 'lib/dropcam.rb', line 34 def cameras response = get(::CAMERAS_GET_VISIBLE, {"group_cameras" => true}, @session.) response_json = JSON.parse(response.body) owned = response_json["items"][0]["owned"] json_to_camera(owned, true) end |
#get_public_camera(token) ⇒ Object
22 23 24 25 26 |
# File 'lib/dropcam.rb', line 22 def get_public_camera(token) response = get(::CAMERAS_GET_BY_PUBLIC_TOKEN, {"token"=>token, "return_deleted"=>true}, @session.) camera = JSON.parse(response.body)["items"][0] Camera.new(camera["uuid"], camera) end |
#public_cameras ⇒ Object
28 29 30 31 32 |
# File 'lib/dropcam.rb', line 28 def public_cameras response = get(::CAMERAS_GET_PUBLIC, {}, @session.) public_cameras = JSON.parse(response.body)["items"] json_to_camera(public_cameras) end |