class Object
Public Instance Methods
auth()
click to toggle source
# File lib/motion_forward/auth.rb, line 1 def auth puts "Setting access token." if File.readable?(@options[:key]) puts "Reading key from file at #{@options[:key]}" @options[:key] = File.read @options[:key] Pushbullet.set_access_token @options[:key] puts "Access token set." else STDERR.puts "File not accessible: #{@options[:key]}" exit -1 end end
file()
click to toggle source
# File lib/motion_forward/file.rb, line 1 def file puts "Event Number: #{@options[:event]}" puts "Filename: #{@options[:path]}" if File.readable? @options[:path] Pushbullet::V2::Push.file(@options[:path], "Event ##{@options[:event]}: front door") puts "File #{@options[:path]} pushed to all devices." else STDERR.puts("File not found: #{@options[:path]}") exit -1 end end
link()
click to toggle source
# File lib/motion_forward/link.rb, line 1 def link Pushbullet::V2::Push.link("Motion: front door", "Event ##{@options[:event]}: Movement has been detected at the front door." , @options[:url]) puts "All devices alerted." end