siriproxy-example 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/lib/siriproxy-example.rb +95 -0
- data/siriproxy-example.gemspec +23 -0
- metadata +51 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b04c167e50655597ae82da4d4494c4c606682df
|
4
|
+
data.tar.gz: 188f7ddf84aa6d2172021ef095a33eb9ef1b1d03
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57030f74716de9063e2561c877ebeec07079c780a61b25dd8ddbc096ec0f37d7d4f3cb56592eac80434eb8f7bb6a6a75f156f3d23490e1990a27d574b4bba5c4
|
7
|
+
data.tar.gz: 172ec74048176b1984090946087b9f987a992d96663e105e2eecea4ef2b4775dca66513356b456d8e6469fa3bf4831a8ace157bf1a8b7b1930e36b4b79cf9c56
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'cora'
|
2
|
+
require 'siri_objects'
|
3
|
+
require 'pp'
|
4
|
+
|
5
|
+
#######
|
6
|
+
# This is a "hello world" style plugin. It simply intercepts the phrase "test siri proxy" and responds
|
7
|
+
# with a message about the proxy being up and running (along with a couple other core features). This
|
8
|
+
# is good base code for other plugins.
|
9
|
+
#
|
10
|
+
# Remember to add other plugins to the "config.yml" file if you create them!
|
11
|
+
######
|
12
|
+
|
13
|
+
class SiriProxy::Plugin::Example < SiriProxy::Plugin
|
14
|
+
def initialize(config)
|
15
|
+
#if you have custom configuration options, process them here!
|
16
|
+
end
|
17
|
+
|
18
|
+
#get the user's location and display it in the logs
|
19
|
+
#filters are still in their early stages. Their interface may be modified
|
20
|
+
filter "SetRequestOrigin", direction: :from_iphone do |object|
|
21
|
+
puts "[Info - User Location] lat: #{object["properties"]["latitude"]}, long: #{object["properties"]["longitude"]}"
|
22
|
+
|
23
|
+
#Note about returns from filters:
|
24
|
+
# - Return false to stop the object from being forwarded
|
25
|
+
# - Return a Hash to substitute or update the object
|
26
|
+
# - Return nil (or anything not a Hash or false) to have the object forwarded (along with any
|
27
|
+
# modifications made to it)
|
28
|
+
end
|
29
|
+
|
30
|
+
listen_for /where am i/i do
|
31
|
+
say "Your location is: #{location.address}"
|
32
|
+
end
|
33
|
+
|
34
|
+
listen_for /test siri proxy/i do
|
35
|
+
say "Siri Proxy is up and running!" #say something to the user!
|
36
|
+
|
37
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
38
|
+
end
|
39
|
+
|
40
|
+
#Demonstrate that you can have Siri say one thing and write another"!
|
41
|
+
listen_for /you don't say/i do
|
42
|
+
say "Sometimes I don't write what I say", spoken: "Sometimes I don't say what I write"
|
43
|
+
end
|
44
|
+
|
45
|
+
#demonstrate state change
|
46
|
+
listen_for /siri proxy test state/i do
|
47
|
+
set_state :some_state #set a state... this is useful when you want to change how you respond after certain conditions are met!
|
48
|
+
say "I set the state, try saying 'confirm state change'"
|
49
|
+
|
50
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
51
|
+
end
|
52
|
+
|
53
|
+
listen_for /confirm state change/i, within_state: :some_state do #this only gets processed if you're within the :some_state state!
|
54
|
+
say "State change works fine!"
|
55
|
+
set_state nil #clear out the state!
|
56
|
+
|
57
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
58
|
+
end
|
59
|
+
|
60
|
+
#demonstrate asking a question
|
61
|
+
listen_for /siri proxy test question/i do
|
62
|
+
response = ask "Is this thing working?" #ask the user for something
|
63
|
+
|
64
|
+
if(response =~ /yes/i) #process their response
|
65
|
+
say "Great!"
|
66
|
+
else
|
67
|
+
say "You could have just said 'yes'!"
|
68
|
+
end
|
69
|
+
|
70
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
71
|
+
end
|
72
|
+
|
73
|
+
#demonstrate capturing data from the user (e.x. "Siri proxy number 15")
|
74
|
+
listen_for /siri proxy number ([0-9,]*[0-9])/i do |number|
|
75
|
+
say "Detected number: #{number}"
|
76
|
+
|
77
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
78
|
+
end
|
79
|
+
|
80
|
+
#demonstrate injection of more complex objects without shortcut methods.
|
81
|
+
listen_for /test map/i do
|
82
|
+
add_views = SiriAddViews.new
|
83
|
+
add_views.make_root(last_ref_id)
|
84
|
+
map_snippet = SiriMapItemSnippet.new
|
85
|
+
map_snippet.items << SiriMapItem.new
|
86
|
+
utterance = SiriAssistantUtteranceView.new("Testing map injection!")
|
87
|
+
add_views.views << utterance
|
88
|
+
add_views.views << map_snippet
|
89
|
+
|
90
|
+
#you can also do "send_object object, target: :guzzoni" in order to send an object to guzzoni
|
91
|
+
send_object add_views #send_object takes a hash or a SiriObject object
|
92
|
+
|
93
|
+
request_completed #always complete your request! Otherwise the phone will "spin" at the user!
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "siriproxy-example"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.authors = ["plamoni"]
|
8
|
+
s.email = ["plamoni@siriproxy.info"]
|
9
|
+
s.homepage = "http://siriproxy.info/"
|
10
|
+
s.summary = %q{An Example Siri Proxy Plugin}
|
11
|
+
s.description = %q{This is a "hello world" style plugin. It simply intercepts the phrase "text siri proxy" and responds with a message about the proxy being up and running. This is good base code for other plugins. }
|
12
|
+
s.licenses = ["MIT"]
|
13
|
+
s.rubyforge_project = "siriproxy-example"
|
14
|
+
|
15
|
+
s.files = `git ls-files 2> /dev/null`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/* 2> /dev/null`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/* 2> /dev/null`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# specify any dependencies here; for example:
|
21
|
+
# s.add_development_dependency "rspec"
|
22
|
+
# s.add_runtime_dependency "rest-client"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: siriproxy-example
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- plamoni
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: 'This is a "hello world" style plugin. It simply intercepts the phrase
|
14
|
+
"text siri proxy" and responds with a message about the proxy being up and running.
|
15
|
+
This is good base code for other plugins. '
|
16
|
+
email:
|
17
|
+
- plamoni@siriproxy.info
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- Rakefile
|
25
|
+
- lib/siriproxy-example.rb
|
26
|
+
- siriproxy-example.gemspec
|
27
|
+
homepage: http://siriproxy.info/
|
28
|
+
licenses:
|
29
|
+
- MIT
|
30
|
+
metadata: {}
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project: siriproxy-example
|
47
|
+
rubygems_version: 2.0.6
|
48
|
+
signing_key:
|
49
|
+
specification_version: 4
|
50
|
+
summary: An Example Siri Proxy Plugin
|
51
|
+
test_files: []
|