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 CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'awesome_print'
4
+ gem "sdp", :git => "git://github.com/turboladen/sdp.git", :branch => "simplify"
5
+
4
6
  # Specify your gem's dependencies in dropcam.gemspec
5
7
  gemspec
@@ -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
@@ -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(name)
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(::IMAGE_PATH, params, @camera.cookies, true)
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
@@ -1,3 +1,3 @@
1
1
  module Dropcam
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/dropcam.rb CHANGED
@@ -15,7 +15,7 @@ module Dropcam
15
15
  c = Camera.new(uuid)
16
16
  c.cookies = @session.cookies
17
17
  c.session_token = @session.session_token
18
- c.properties = c.info
18
+ c.update_info
19
19
  c
20
20
  end
21
21
 
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.2
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-01-13 00:00:00.000000000 Z
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