Code Monkey home page Code Monkey logo

siri-ruby's Introduction

siri-ruby

We use siri to create notes, we then read from icloud imap server and execute commands

The idea was stolen from SiriAPI8. But because I do not like programming in python I rewrote the class in ruby.

At the moment the program in only working with os x 10.10 and before. Notes added with ios 9 and after are no longer accessable with imap.

A simple workaround is to dictate a mail with the defined subject to the own mail account.

"send a mail to office, light off"

The new version handles text and subject with defined keys.

Quite simple.

Create and connect to server

note = Note.new( USERNAME, PASSWD )

DSL for creating commands and bind strings

note.build do
  add_command( :switch_light_on, [ "light on", "make light", "lightning" ] ),
  add_command( :switch_lign_off, [ "light off", "make it dark", "off" ] )
end.

Running and bind to keyword

note.run( 'iphone' ) do | item |
   # optional block if you like to make something special
   # with item
   pp item
end

Create commands

# ----------------------------------
# external command we've bind
# ----------------------------------
def switch_light_on
  puts "*** switch_light_on"
  Piface.write 0, 1
  true # if true message will be deleted from imap server
end

# ----------------------------------
# external command we've bind
# ----------------------------------
def switch_light_off
  puts "*** switch_light_off"
  Piface.write 0, 0
  true
end

References

http://blog.smartnoob.de/2015/01/26/siriapi8-siri-api-fuer-ios8/#more-1010 https://github.com/HcDevel/SiriAPI8/blob/master/SiriAPI8/SiriAPI.py https://github.com/tpitale/mail_room https://gist.github.com/oogali/3528688 https://github.com/ConradIrwin/em-imap/blob/5424d9b4cf87488604e295cad3aadc3d9b723fdc/lib/em-imap/client.rb https://gist.github.com/solyaris/b993283667f15effa579

siri-ruby's People

Contributors

wiiikiii avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.