Class: AllSeeingPi::Golem
- Inherits:
-
Object
- Object
- AllSeeingPi::Golem
- Defined in:
- lib/all_seeing_pi/golem.rb
Instance Attribute Summary collapse
-
#camera ⇒ Object
readonly
Returns the value of attribute camera.
-
#uploader ⇒ Object
readonly
Returns the value of attribute uploader.
Instance Method Summary collapse
-
#initialize ⇒ Golem
constructor
A new instance of Golem.
- #report(msg) ⇒ Object
- #spy ⇒ Object
- #store_image(image_path) ⇒ Object
Constructor Details
#initialize ⇒ Golem
Returns a new instance of Golem.
8 9 10 11 |
# File 'lib/all_seeing_pi/golem.rb', line 8 def initialize @camera = AllSeeingPi::Camera.new @uploader = AllSeeingPi::Uploader.new end |
Instance Attribute Details
#camera ⇒ Object (readonly)
Returns the value of attribute camera.
6 7 8 |
# File 'lib/all_seeing_pi/golem.rb', line 6 def camera @camera end |
#uploader ⇒ Object (readonly)
Returns the value of attribute uploader.
6 7 8 |
# File 'lib/all_seeing_pi/golem.rb', line 6 def uploader @uploader end |
Instance Method Details
#report(msg) ⇒ Object
23 24 25 |
# File 'lib/all_seeing_pi/golem.rb', line 23 def report(msg) puts msg unless ENV['ALL_SEEING_PI_ENV'] == 'test' end |
#spy ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/all_seeing_pi/golem.rb', line 13 def spy image_path = @camera.capture return unless File.exists?(image_path) report "Captured #{image_path}" store_image(image_path) FileUtils.rm(image_path) end |
#store_image(image_path) ⇒ Object
27 28 29 |
# File 'lib/all_seeing_pi/golem.rb', line 27 def store_image(image_path) @uploader.upload(image_path) end |