foscam-ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +4 -0
- data/README.md +13 -3
- data/Rakefile +3 -0
- data/foscam-ruby.gemspec +0 -4
- data/lib/foscam-ruby.rb +1 -1
- data/lib/foscam/client.rb +22 -21
- data/lib/foscam/version.rb +1 -1
- data/spec/foscam/client_spec.rb +55 -55
- data/spec/spec_helper.rb +22 -23
- metadata +3 -59
- data/Guardfile +0 -10
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTkyMzY0NmMwMWI2ZWRmNjIxMTQ0N2UyNjRjMjY1NTEyODRkNmNiNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmNhMjVjODY5MDVmOGVkNzExZmQ2OGFjMWRkNDExYTA4YjU4NDk3Mw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjE5ZmVkYWY4NDZiZjE5MTRmMDg3NjE4ZjBmNjJkN2E3YTVlODVmNmFiNWMy
|
10
|
+
MmIwNTI0Njc5MWVlYWEyODAwNzY2OTcyNjAyODEwYThmOTlhMjEwNzgxYTI5
|
11
|
+
MzAxZWZiNjU4YWZiNzBlMWM5OGZmMzM4MjhlZTZjZDNkODRmZjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWQxY2NlYTYyODFkZGQxZGE1ZThmM2QyN2M2ZjVjMGFhZTk2ODViZWQ3YzY4
|
14
|
+
YWVmYjVmZmZkMjhhZjc3N2ZkMTY1MTljMzMxYzA0YjFjMzUzODRkNGU5ZGVl
|
15
|
+
ODgzMjI4YTdkOWEyNDYzMTFmMzhlMWI2MmIxMGMyN2RhNjc2MTk=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Foscam::Ruby
|
2
2
|
|
3
|
-
|
3
|
+
A client library written in ruby to communicate to your [foscam webcam](http://www.foscam.com/) using the [foscam SDK](http://site.usajumping.com/Download/ipcam_cgi_sdk.pdf).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -17,8 +17,18 @@ Or install it yourself as:
|
|
17
17
|
$ gem install foscam-ruby
|
18
18
|
|
19
19
|
## Usage
|
20
|
-
|
21
|
-
|
20
|
+
|
21
|
+
# Connecting to a camera
|
22
|
+
client = Foscam::Client.new(url: http://192.168.0.1/, username: 'admin', password: 'secret')
|
23
|
+
|
24
|
+
# Capturing the current Image
|
25
|
+
client.snapshot # =>
|
26
|
+
|
27
|
+
# Controlling the pan or tilt of camera
|
28
|
+
client.decoder_control(:up)
|
29
|
+
client.decoder_control(:stop_up)
|
30
|
+
client.decoder_control(:left)
|
31
|
+
client.decoder_control(:horizontal_patrol)
|
22
32
|
|
23
33
|
## Contributing
|
24
34
|
|
data/Rakefile
CHANGED
data/foscam-ruby.gemspec
CHANGED
@@ -21,14 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'faraday'
|
22
22
|
spec.add_dependency 'mini_magick'
|
23
23
|
spec.add_dependency 'active_support'
|
24
|
-
spec.add_dependency 'i18n'
|
25
24
|
|
26
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
27
26
|
spec.add_development_dependency "rake"
|
28
27
|
spec.add_development_dependency 'rspec'#, '~> 2.10.0'
|
29
|
-
spec.add_development_dependency 'guard'
|
30
|
-
spec.add_development_dependency 'guard-rspec'
|
31
|
-
spec.add_development_dependency 'rb-fsevent'
|
32
28
|
spec.add_development_dependency 'vcr'
|
33
29
|
spec.add_development_dependency 'webmock'
|
34
30
|
end
|
data/lib/foscam-ruby.rb
CHANGED
data/lib/foscam/client.rb
CHANGED
@@ -60,29 +60,30 @@ module Foscam
|
|
60
60
|
CAMERA_CONTROL_RESOLUTION = CAMERA_PARAMS_RESOLUTION.inject({}){|memo,(k,v)| memo[v.to_sym] = k; memo}
|
61
61
|
|
62
62
|
CAMERA_CONTROLS = {
|
63
|
-
resolution
|
64
|
-
brightness
|
65
|
-
contrast
|
66
|
-
mode
|
67
|
-
flip
|
63
|
+
:resolution => 0,
|
64
|
+
:brightness => 1,
|
65
|
+
:contrast => 2,
|
66
|
+
:mode => 3,
|
67
|
+
:flip => 5
|
68
68
|
}
|
69
69
|
|
70
70
|
DECODER_CONTROLS = {
|
71
|
-
up
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
71
|
+
:up => 0,
|
72
|
+
:stop => 1,
|
73
|
+
:stop_up => 1,
|
74
|
+
:down => 2,
|
75
|
+
:stop_down => 3,
|
76
|
+
:left => 4,
|
77
|
+
:stop_left => 5,
|
78
|
+
:right => 6,
|
79
|
+
:stop_right => 7,
|
80
|
+
:center => 25,
|
81
|
+
:vertical_patrol => 26,
|
82
|
+
:stop_vertical_patrol => 27,
|
83
|
+
:horizon_patrol => 28,
|
84
|
+
:stop_horizon_patrol => 29,
|
85
|
+
:io_output_high => 94,
|
86
|
+
:io_output_low => 95,
|
86
87
|
}
|
87
88
|
|
88
89
|
USER_PERMISSIONS = {
|
@@ -134,7 +135,7 @@ module Foscam
|
|
134
135
|
@url = url
|
135
136
|
@username = username
|
136
137
|
@password = password
|
137
|
-
@connection = Faraday.new( url
|
138
|
+
@connection = Faraday.new( :url => @url) unless @url.nil?
|
138
139
|
@connection.basic_auth(@username, @password) unless @username.nil? && @password.nil?
|
139
140
|
end
|
140
141
|
|
data/lib/foscam/version.rb
CHANGED
data/spec/foscam/client_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Foscam::Client do
|
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
@service = Foscam::Client.new
|
7
|
-
@connection = Faraday.new( url
|
7
|
+
@connection = Faraday.new( :url => FOSCAM_URL)
|
8
8
|
@connection.basic_auth(FOSCAM_USERNAME, FOSCAM_PASSWORD)
|
9
9
|
@service.connection = @connection
|
10
10
|
end
|
@@ -183,21 +183,21 @@ describe Foscam::Client do
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
it "returns true when set using a string" do
|
186
|
-
response = @service.camera_control(resolution
|
186
|
+
response = @service.camera_control(:resolution => "QVGA")
|
187
187
|
response.should be_true
|
188
188
|
end
|
189
189
|
it "returns true when set using a number" do
|
190
|
-
response = @service.camera_control(resolution
|
190
|
+
response = @service.camera_control(:resolution => 8)
|
191
191
|
response.should be_true
|
192
192
|
end
|
193
193
|
end
|
194
194
|
context "with invalid parameters" do
|
195
195
|
it "raises an exception with invalid number" do
|
196
|
-
expect {@service.camera_control(resolution
|
196
|
+
expect {@service.camera_control(:resolution => 0)}.to raise_error
|
197
197
|
end
|
198
198
|
|
199
199
|
it "raises an exception with invalid string" do
|
200
|
-
expect {@service.camera_control(resolution
|
200
|
+
expect {@service.camera_control(:resolution => "XVGA")}.to raise_error
|
201
201
|
end
|
202
202
|
end
|
203
203
|
end
|
@@ -210,17 +210,17 @@ describe Foscam::Client do
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
it "returns true" do
|
213
|
-
response = @service.camera_control( brightness
|
213
|
+
response = @service.camera_control( :brightness => 160)
|
214
214
|
response.should be_true
|
215
215
|
end
|
216
216
|
end
|
217
217
|
context "with invalid parameters" do
|
218
218
|
it "raises an exception when < 0" do
|
219
|
-
expect {@service.camera_control( brightness
|
219
|
+
expect {@service.camera_control( :brightness => -1)}.to raise_error
|
220
220
|
end
|
221
221
|
|
222
222
|
it "raises an exception when > 255" do
|
223
|
-
expect {@service.camera_control( brightness
|
223
|
+
expect {@service.camera_control( :brightness => 256)}.to raise_error
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -233,17 +233,17 @@ describe Foscam::Client do
|
|
233
233
|
end
|
234
234
|
end
|
235
235
|
it "returns true" do
|
236
|
-
response = @service.camera_control(contrast
|
236
|
+
response = @service.camera_control(:contrast => 4)
|
237
237
|
response.should be_true
|
238
238
|
end
|
239
239
|
end
|
240
240
|
context "with invalid parameters" do
|
241
241
|
it "raises an exception when < 0" do
|
242
|
-
expect {@service.camera_control( contrast
|
242
|
+
expect {@service.camera_control( :contrast => -1)}.to raise_error
|
243
243
|
end
|
244
244
|
|
245
245
|
it "raises an exception when > 6" do
|
246
|
-
expect {@service.camera_control( contrast
|
246
|
+
expect {@service.camera_control( :contrast => 7)}.to raise_error
|
247
247
|
end
|
248
248
|
end
|
249
249
|
end
|
@@ -256,20 +256,20 @@ describe Foscam::Client do
|
|
256
256
|
end
|
257
257
|
end
|
258
258
|
it "returns true" do
|
259
|
-
response = @service.camera_control( mode
|
259
|
+
response = @service.camera_control( :mode => :outdoor)
|
260
260
|
response.should be_true
|
261
261
|
end
|
262
262
|
end
|
263
263
|
context "with invalid parameters" do
|
264
264
|
it "raises an exception when < 0" do
|
265
|
-
expect {@service.camera_control( mode
|
265
|
+
expect {@service.camera_control( :mode => -1)}.to raise_error
|
266
266
|
end
|
267
267
|
|
268
268
|
it "raises an exception when > 2" do
|
269
|
-
expect {@service.camera_control( mode
|
269
|
+
expect {@service.camera_control( :mode => 3)}.to raise_error
|
270
270
|
end
|
271
271
|
it "raises an exception with an invalid string" do
|
272
|
-
expect {@service.camera_control( mode
|
272
|
+
expect {@service.camera_control( :mode => "10Hz")}.to raise_error
|
273
273
|
end
|
274
274
|
end
|
275
275
|
end
|
@@ -282,20 +282,20 @@ describe Foscam::Client do
|
|
282
282
|
end
|
283
283
|
end
|
284
284
|
it "returns true" do
|
285
|
-
response = @service.camera_control(flip
|
285
|
+
response = @service.camera_control(:flip => "mirror")
|
286
286
|
response.should be_true
|
287
287
|
end
|
288
288
|
end
|
289
289
|
context "with invalid parameters" do
|
290
290
|
it "raises an exception when < 0" do
|
291
|
-
expect {@service.camera_control(flip
|
291
|
+
expect {@service.camera_control(:flip => -1)}.to raise_error
|
292
292
|
end
|
293
293
|
|
294
294
|
it "raises an exception when > 3" do
|
295
|
-
expect {@service.camera_control(flip
|
295
|
+
expect {@service.camera_control(:flip => 4)}.to raise_error
|
296
296
|
end
|
297
297
|
it "raises an exception with an invalid string" do
|
298
|
-
expect {@service.camera_control( mode
|
298
|
+
expect {@service.camera_control( :mode => "diagonal")}.to raise_error
|
299
299
|
end
|
300
300
|
end
|
301
301
|
end
|
@@ -308,7 +308,7 @@ describe Foscam::Client do
|
|
308
308
|
@service.connection = @connection
|
309
309
|
end
|
310
310
|
it "returns a hash of variables" do
|
311
|
-
response = @service.camera_control(brightness
|
311
|
+
response = @service.camera_control(:brightness => 160)
|
312
312
|
response.should be_false
|
313
313
|
end
|
314
314
|
end
|
@@ -597,7 +597,7 @@ describe Foscam::Client do
|
|
597
597
|
end
|
598
598
|
end
|
599
599
|
it "returns a hash of variables" do
|
600
|
-
params = {tz
|
600
|
+
params = {:tz =>18000, :ntp_enable => 1, :ntp_svr => "0.ca.pool.ntp.org"}
|
601
601
|
response = @service.set_datetime(params)
|
602
602
|
response.should be_true
|
603
603
|
end
|
@@ -605,7 +605,7 @@ describe Foscam::Client do
|
|
605
605
|
|
606
606
|
context "with invalid parameters" do
|
607
607
|
it "raises an exception when ntp_server more than 64 characters long" do
|
608
|
-
expect {@service.set_datetime(ntp_svr
|
608
|
+
expect {@service.set_datetime(:ntp_svr => "012345678901234567890123456789012345678901234567890123456789012345")}.to raise_error
|
609
609
|
end
|
610
610
|
end
|
611
611
|
|
@@ -628,7 +628,7 @@ describe Foscam::Client do
|
|
628
628
|
context "with valid parameters" do
|
629
629
|
it "sets user 2 name, password, and privilages" do
|
630
630
|
::VCR.use_cassette("foscam_set_user2") do
|
631
|
-
params = {user2
|
631
|
+
params = {:user2 => "user2", :pwd2 => "pass2", :pri2 => 0}
|
632
632
|
response = @service.set_users(params)
|
633
633
|
response.should be_true
|
634
634
|
end
|
@@ -636,7 +636,7 @@ describe Foscam::Client do
|
|
636
636
|
|
637
637
|
it "sets user 3 name, password, and privilages" do
|
638
638
|
::VCR.use_cassette("foscam_set_user3") do
|
639
|
-
params = {user3
|
639
|
+
params = {:user3 => "user3", :pwd3 => "pass3", :pri3 => 0}
|
640
640
|
response = @service.set_users(params)
|
641
641
|
response.should be_true
|
642
642
|
end
|
@@ -644,7 +644,7 @@ describe Foscam::Client do
|
|
644
644
|
|
645
645
|
it "sets user 4 name, password, and privilages" do
|
646
646
|
::VCR.use_cassette("foscam_set_user4") do
|
647
|
-
params = {user4
|
647
|
+
params = {:user4 => "user4", :pwd4 => "pass4", :pri4 => 0}
|
648
648
|
response = @service.set_users(params)
|
649
649
|
response.should be_true
|
650
650
|
end
|
@@ -652,7 +652,7 @@ describe Foscam::Client do
|
|
652
652
|
|
653
653
|
it "sets user 5 name, password, and privilages" do
|
654
654
|
::VCR.use_cassette("foscam_set_user5") do
|
655
|
-
params = {user5
|
655
|
+
params = {:user5 => "user5", :pwd4 => "pass5", :pri5 => 0}
|
656
656
|
response = @service.set_users(params)
|
657
657
|
response.should be_true
|
658
658
|
end
|
@@ -660,7 +660,7 @@ describe Foscam::Client do
|
|
660
660
|
|
661
661
|
it "sets user 6 name, password, and privilages" do
|
662
662
|
::VCR.use_cassette("foscam_set_user6") do
|
663
|
-
params = {user6
|
663
|
+
params = {:user6 => "user6", :pwd6 => "pass6", :pri6 => 0}
|
664
664
|
response = @service.set_users(params)
|
665
665
|
response.should be_true
|
666
666
|
end
|
@@ -668,7 +668,7 @@ describe Foscam::Client do
|
|
668
668
|
|
669
669
|
it "sets user 7 name, password, and privilages" do
|
670
670
|
::VCR.use_cassette("foscam_set_user7") do
|
671
|
-
params = {user7
|
671
|
+
params = {:user7 => "user7", :pwd7 => "pass7", :pri7 => 0}
|
672
672
|
response = @service.set_users(params)
|
673
673
|
response.should be_true
|
674
674
|
end
|
@@ -676,7 +676,7 @@ describe Foscam::Client do
|
|
676
676
|
|
677
677
|
it "sets user 8 name, password, and privilages" do
|
678
678
|
::VCR.use_cassette("foscam_set_user8") do
|
679
|
-
params = {user8
|
679
|
+
params = {:user8 => "user8", :pwd7 => "pass8", :pri8 => 0}
|
680
680
|
response = @service.set_users(params)
|
681
681
|
response.should be_true
|
682
682
|
end
|
@@ -727,7 +727,7 @@ describe Foscam::Client do
|
|
727
727
|
end
|
728
728
|
end
|
729
729
|
it "returns a hash of variables" do
|
730
|
-
params = {ip
|
730
|
+
params = {:ip => "192.168.0.100", :mask => "0.0.0.0", :gateway => "0.0.0.0", :dns => "8.8.8.8", :port => "8080"}
|
731
731
|
response = @service.set_network(params)
|
732
732
|
response.should be_true
|
733
733
|
end
|
@@ -757,7 +757,7 @@ describe Foscam::Client do
|
|
757
757
|
end
|
758
758
|
end
|
759
759
|
it "returns a hash of variables" do
|
760
|
-
params = {ssid
|
760
|
+
params = {:ssid => "my_wireless_ssid", :enable => 1, :encrypt => 1, :wpa_psk => "my_wireless_password"}
|
761
761
|
response = @service.set_wifi(params)
|
762
762
|
response.should be_true
|
763
763
|
end
|
@@ -789,17 +789,17 @@ describe Foscam::Client do
|
|
789
789
|
end
|
790
790
|
end
|
791
791
|
it "returns a hash of variables" do
|
792
|
-
params = {enable
|
792
|
+
params = {:enable => 1, :user => "root", :pwd => "pass"}
|
793
793
|
response = @service.set_pppoe(params)
|
794
794
|
response.should be_true
|
795
795
|
end
|
796
796
|
end
|
797
797
|
context "with invalid parameters" do
|
798
798
|
it "raises an exception when username is more than 40 characters long" do
|
799
|
-
expect {@service.set_pppoe(user
|
799
|
+
expect {@service.set_pppoe(:user => "01234567890123456789012345678901234567891")}.to raise_error
|
800
800
|
end
|
801
801
|
it "raises an exception when password is more than 20 characters long" do
|
802
|
-
expect {@service.set_pppoe(pwd
|
802
|
+
expect {@service.set_pppoe(:pwd => "012345678901234567890")}.to raise_error
|
803
803
|
end
|
804
804
|
end
|
805
805
|
context "response is unsuccessful" do
|
@@ -855,23 +855,23 @@ describe Foscam::Client do
|
|
855
855
|
end
|
856
856
|
end
|
857
857
|
it "returns a hash of variables" do
|
858
|
-
params = {service
|
858
|
+
params = {:service => 3, :user => "root", :pwd => "password", :host => "hostname.dyndns.com"}
|
859
859
|
response = @service.set_ddns(params)
|
860
860
|
response.should be_true
|
861
861
|
end
|
862
862
|
end
|
863
863
|
context "with invalid parameters" do
|
864
864
|
it "raises an exception when username is more than 20 characters long" do
|
865
|
-
expect {@service.set_ddns(user
|
865
|
+
expect {@service.set_ddns(:user => "012345678901234567890")}.to raise_error
|
866
866
|
end
|
867
867
|
it "raises an exception when password is more than 20 characters long" do
|
868
|
-
expect {@service.set_ddns(pwd
|
868
|
+
expect {@service.set_ddns(:pwd => "012345678901234567890")}.to raise_error
|
869
869
|
end
|
870
870
|
it "raises an exception when proxy_svr is more than 20 characters long" do
|
871
|
-
expect {@service.set_ddns(proxy_svr
|
871
|
+
expect {@service.set_ddns(:proxy_svr => "012345678901234567890")}.to raise_error
|
872
872
|
end
|
873
873
|
it "raises an exception when host is more than 40 characters long" do
|
874
|
-
expect {@service.set_ddns(host
|
874
|
+
expect {@service.set_ddns(:host => "01234567890123456789012345678901234567890")}.to raise_error
|
875
875
|
end
|
876
876
|
end
|
877
877
|
context "response is unsuccessful" do
|
@@ -898,7 +898,7 @@ describe Foscam::Client do
|
|
898
898
|
end
|
899
899
|
end
|
900
900
|
it "returns a hash of variables" do
|
901
|
-
params = {svr
|
901
|
+
params = {:svr => "192.168.0.116", :port => 21, :user => "my_username", :pwd =>"my_password", :dir => "R2D2", :upload_interval => 3600}
|
902
902
|
response = @service.set_ftp(params)
|
903
903
|
response.should be_true
|
904
904
|
end
|
@@ -928,17 +928,17 @@ describe Foscam::Client do
|
|
928
928
|
end
|
929
929
|
end
|
930
930
|
it "returns a hash of variables" do
|
931
|
-
params = {svr
|
931
|
+
params = {:svr => "smtp.gmail.com", :port => 465, :user => "username@gmail.com", :pwd =>"password", :sender => "sender@gmail.com", :receiver1 => "receiver@gmail.com"}
|
932
932
|
response = @service.set_mail(params)
|
933
933
|
response.should be_true
|
934
934
|
end
|
935
935
|
end
|
936
936
|
context "with invalid parameters" do
|
937
937
|
it "raises an exception when username is more than 20 characters long" do
|
938
|
-
expect {@service.set_mail(user
|
938
|
+
expect {@service.set_mail(:user => "012345678901234567890")}.to raise_error
|
939
939
|
end
|
940
940
|
it "raises an exception when password is more than 20 characters long" do
|
941
|
-
expect {@service.set_mail(pwd
|
941
|
+
expect {@service.set_mail(:pwd => "012345678901234567890")}.to raise_error
|
942
942
|
end
|
943
943
|
end
|
944
944
|
context "response is unsuccessful" do
|
@@ -966,7 +966,7 @@ describe Foscam::Client do
|
|
966
966
|
end
|
967
967
|
end
|
968
968
|
it "returns a hash of variables" do
|
969
|
-
params = {motion_armed
|
969
|
+
params = {:motion_armed => 0, :motion_sensitivity => 3, :input_armed => 0, :iolinkage => 0, :mail => 0, :upload_interval => 0}
|
970
970
|
response = @service.set_alarm(params)
|
971
971
|
response.should be_true
|
972
972
|
end
|
@@ -997,7 +997,7 @@ describe Foscam::Client do
|
|
997
997
|
end
|
998
998
|
end
|
999
999
|
it "returns a hash of variables" do
|
1000
|
-
params = {port
|
1000
|
+
params = {:port => 0, :baud => 15, :bytes => "dsfds", :data => "url_code"}
|
1001
1001
|
response = @service.comm_write(params)
|
1002
1002
|
response.should be_true
|
1003
1003
|
end
|
@@ -1028,13 +1028,13 @@ describe Foscam::Client do
|
|
1028
1028
|
end
|
1029
1029
|
it "returns a hash of variables" do
|
1030
1030
|
params = {
|
1031
|
-
schedule_sun_0
|
1032
|
-
schedule_mon_0
|
1033
|
-
schedule_tue_0
|
1034
|
-
schedule_wed_0
|
1035
|
-
schedule_thu_0
|
1036
|
-
schedule_fri_0
|
1037
|
-
schedule_sat_0
|
1031
|
+
:schedule_sun_0 => 95, :schedule_sun_1 => 45, :schedule_sun_2 => 20,
|
1032
|
+
:schedule_mon_0 => 95, :schedule_mon_1 => 45, :schedule_mon_2 => 20,
|
1033
|
+
:schedule_tue_0 => 95, :schedule_tue_1 => 45, :schedule_tue_2 => 20,
|
1034
|
+
:schedule_wed_0 => 95, :schedule_wed_1 => 45, :schedule_wed_2 => 20,
|
1035
|
+
:schedule_thu_0 => 95, :schedule_thu_1 => 45, :schedule_thu_2 => 20,
|
1036
|
+
:schedule_fri_0 => 95, :schedule_fri_1 => 45, :schedule_fri_2 => 20,
|
1037
|
+
:schedule_sat_0 => 95, :schedule_sat_1 => 45, :schedule_sat_2 => 20
|
1038
1038
|
}
|
1039
1039
|
response = @service.set_forbidden(params)
|
1040
1040
|
response.should be_true
|
@@ -1138,15 +1138,15 @@ describe Foscam::Client do
|
|
1138
1138
|
end
|
1139
1139
|
|
1140
1140
|
it "raises an exception when password is more than 20 characters long" do
|
1141
|
-
expect {@service.set_misc(pwd
|
1141
|
+
expect {@service.set_misc(:pwd => "012345678901234567890")}.to raise_error
|
1142
1142
|
end
|
1143
1143
|
|
1144
1144
|
it "raises an exception if there is no match for the led_mode" do
|
1145
|
-
expect {@service.set_misc(led_mode
|
1145
|
+
expect {@service.set_misc(:led_mode => :mode5)}.to raise_error
|
1146
1146
|
end
|
1147
1147
|
|
1148
1148
|
it "raises an exception if there is no match for the ptz_auto_patrol_type" do
|
1149
|
-
expect {@service.set_misc(ptz_auto_patrol_type
|
1149
|
+
expect {@service.set_misc(:ptz_auto_patrol_type => :vert)}.to raise_error
|
1150
1150
|
end
|
1151
1151
|
|
1152
1152
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
|
4
|
-
require 'vcr'
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
c.
|
14
|
-
c.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
class
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# some (optional) config here
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'vcr'
|
5
|
+
require 'foscam-ruby' # and any other gems you need
|
6
|
+
|
7
|
+
FOSCAM_USERNAME = 'my_username'
|
8
|
+
FOSCAM_PASSWORD = 'my_password'
|
9
|
+
FOSCAM_URL = "http://192.168.0.117/"
|
10
|
+
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.cassette_library_dir = 'spec/fixtures/vcr'
|
13
|
+
c.hook_into :webmock
|
14
|
+
# c.allow_http_connections_when_no_cassette = true
|
15
|
+
end
|
16
|
+
|
17
|
+
module Boolean; end
|
18
|
+
class TrueClass; include Boolean; end
|
19
|
+
class FalseClass; include Boolean; end
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# some (optional) config here
|
24
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foscam-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Waddington
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-03-
|
11
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: i18n
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ! '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: bundler
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,48 +94,6 @@ dependencies:
|
|
108
94
|
- - ! '>='
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: guard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ! '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: guard-rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ! '>='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ! '>='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rb-fsevent
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ! '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ! '>='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
97
|
- !ruby/object:Gem::Dependency
|
154
98
|
name: vcr
|
155
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,8 +130,8 @@ extensions: []
|
|
186
130
|
extra_rdoc_files: []
|
187
131
|
files:
|
188
132
|
- .gitignore
|
133
|
+
- .travis.yml
|
189
134
|
- Gemfile
|
190
|
-
- Guardfile
|
191
135
|
- LICENSE.txt
|
192
136
|
- README.md
|
193
137
|
- Rakefile
|
data/Guardfile
DELETED