dropcam 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/example/screenshot.rb +9 -0
- data/lib/dropcam/base.rb +7 -7
- data/lib/dropcam/screenshot.rb +4 -6
- data/lib/dropcam/version.rb +1 -1
- data/lib/dropcam.rb +1 -1
- metadata +3 -2
data/Gemfile
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'dropcam'
|
5
|
+
require 'awesome_print'
|
6
|
+
dropcam = Dropcam::Dropcam.new(ENV["DROPCAM_USERNAME"],ENV["DROPCAM_PASSWORD"])
|
7
|
+
camera = dropcam.cameras.first
|
8
|
+
screenshot = camera.screenshot.current
|
9
|
+
File.open("#{camera.title}.jpeg", 'w') {|f| f.write(screenshot) }
|
data/lib/dropcam/base.rb
CHANGED
@@ -26,11 +26,11 @@ module Dropcam
|
|
26
26
|
|
27
27
|
::NEXUS_API_BASE = "https://nexusapi.dropcam.com/"
|
28
28
|
|
29
|
-
::NEXUS_GET_IMAGE_PATH = "get_image" # uuid and width
|
30
|
-
::NEXUS_GET_AVAILABLE_PATH = "get_available" # start_time and uuid
|
31
|
-
::NEXUS_GET_CUEPOINT_PATH = "get_cuepoint" # start_time_uuid
|
32
|
-
::NEXUS_GET_EVENT_CLIP_PATH = "get_event_clip" # start_time_uuid
|
33
|
-
::NEXUS_GET_REVERSE_PAGINATED_CUEPOINTS_PATH = "get_reverse_paginated_cuepoint"
|
29
|
+
::NEXUS_GET_IMAGE_PATH = "/get_image" # uuid and width
|
30
|
+
::NEXUS_GET_AVAILABLE_PATH = "/get_available" # start_time and uuid
|
31
|
+
::NEXUS_GET_CUEPOINT_PATH = "/get_cuepoint" # start_time_uuid
|
32
|
+
::NEXUS_GET_EVENT_CLIP_PATH = "/get_event_clip" # start_time_uuid
|
33
|
+
::NEXUS_GET_REVERSE_PAGINATED_CUEPOINTS_PATH = "/get_reverse_paginated_cuepoint"
|
34
34
|
::API_BASE = "https://www.dropcam.com"
|
35
35
|
::API_PATH = "/api/v1"
|
36
36
|
|
@@ -91,13 +91,13 @@ module Dropcam
|
|
91
91
|
|
92
92
|
def get(path, parameters,cookies, use_nexus=false)
|
93
93
|
http = _dropcam_http(use_nexus)
|
94
|
-
|
94
|
+
|
95
95
|
query_path = "#{path}"
|
96
96
|
query_path = "#{path}?#{URI.encode_www_form(parameters)}" if parameters.length > 0
|
97
97
|
request = Net::HTTP::Get.new(query_path)
|
98
98
|
|
99
99
|
request.add_field("Cookie",cookies.join('; ')) if cookies
|
100
|
-
|
100
|
+
|
101
101
|
response = http.request(request)
|
102
102
|
if response.success?
|
103
103
|
return response
|
data/lib/dropcam/screenshot.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
|
1
|
+
require_relative 'base'
|
2
2
|
module Dropcam
|
3
3
|
class Screenshot < Base
|
4
4
|
#
|
5
5
|
attr_accessor :camera
|
6
|
-
def initialize(
|
6
|
+
def initialize(camera)
|
7
7
|
@camera = camera
|
8
|
-
@name = name
|
9
|
-
@current_value = value
|
10
8
|
end
|
11
9
|
|
12
10
|
def current(width=1200)
|
@@ -16,8 +14,8 @@ module Dropcam
|
|
16
14
|
def image_at_time(timestamp, width=1200)
|
17
15
|
params = {"uuid"=>@camera.uuid, "width" => width}
|
18
16
|
params["time"] = timestamp if timestamp
|
19
|
-
response = get(::
|
20
|
-
return response
|
17
|
+
response = get(::NEXUS_GET_IMAGE_PATH, params, @camera.cookies, true)
|
18
|
+
return response.body
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
data/lib/dropcam/version.rb
CHANGED
data/lib/dropcam.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropcam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Access Dropcam account and cameras
|
15
15
|
email:
|
@@ -27,6 +27,7 @@ files:
|
|
27
27
|
- example/basics.rb
|
28
28
|
- example/camera.rb
|
29
29
|
- example/notifications.rb
|
30
|
+
- example/screenshot.rb
|
30
31
|
- example/settings.rb
|
31
32
|
- example/stream.rb
|
32
33
|
- lib/dropcam.rb
|