karotz 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/karotz.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
+ s.add_development_dependency "rails"
20
21
  s.add_development_dependency "rake"
21
22
  s.add_development_dependency "rspec"
22
23
  s.add_development_dependency "pry"
data/lib/karotz/client.rb CHANGED
@@ -28,7 +28,7 @@ module Karotz
28
28
  API = "http://api.karotz.com/api/karotz/"
29
29
  DIGEST = OpenSSL::Digest::Digest.new('sha1')
30
30
 
31
- class << self # TODO add the rest of the API calls
31
+ class << self
32
32
 
33
33
  #==========EARS=================
34
34
 
@@ -36,6 +36,10 @@ module Karotz
36
36
  request :ears, interactive_id, params
37
37
  end
38
38
 
39
+ def sad(interactive_id)
40
+ ears interactive_id, :left => 9, :right => 9
41
+ end
42
+
39
43
  #============LED================
40
44
 
41
45
  def led(interactive_id, params={})
@@ -72,6 +76,10 @@ module Karotz
72
76
  end
73
77
  alias :play :multimedia
74
78
 
79
+ def nyan(interactive_id)
80
+ multimedia interactive_id, :url => "http://api.ning.com:80/files/3zmSvhA*3jKxFJj1I5uh5dp5oCynyyMksQjwS3JWWQNlriTzDzX61KtlFnuQtx-hEmV7NdqVgofmZvh7cXOX-UVJ47m1SR4a/nyanlooped.mp3"
81
+ end
82
+
75
83
  #============WEBCAM=========
76
84
 
77
85
  def webcam(interactive_id, params={})
@@ -103,6 +111,8 @@ module Karotz
103
111
  def stop(interactive_id, params={})
104
112
  request(:interactivemode, interactive_id, {:action => :stop}.merge(params))
105
113
  end
114
+ alias :destroy :stop
115
+ alias :disconnect :stop
106
116
 
107
117
  def session # TODO multimedia-api is not blocking, so we need some whay to find out when we can kill the session properly
108
118
  client = create
@@ -111,12 +121,13 @@ module Karotz
111
121
  stop(client.interactive_id) if client
112
122
  end
113
123
 
114
- #===========HELPERS================
115
-
116
124
  def create
117
125
  interactive_id = start
118
126
  new(interactive_id)
119
127
  end
128
+ alias :connect :create
129
+
130
+ #===========HELPERS================
120
131
 
121
132
  def start_url(install_id, api_key, secret, once=rand(99999999999999), timestamp=Time.now.to_i)
122
133
  params = {
data/lib/karotz/color.rb CHANGED
@@ -10,7 +10,5 @@ module Karotz
10
10
  RED = "FF0000"
11
11
  YELLOW = "75FF00"
12
12
  WHITE = "4FFF68"
13
-
14
- # TODO add color mixing method for RGB usage
15
13
  end
16
14
  end
@@ -0,0 +1,29 @@
1
+ namespace :karotz do
2
+ namespace :build do
3
+ desc "build failed trigger"
4
+ task :failed => :setup do
5
+ Karotz::Client.session do |karotz|
6
+ karotz.light :color => Karotz::Color::RED
7
+ karotz.speak :text => "build failed"
8
+ sleep(3) # kill session some time after talking
9
+ end
10
+ end
11
+
12
+ desc "build normal trigger"
13
+ task :normal => :setup do
14
+ Karotz::Client.session do |karotz|
15
+ karotz.light :color => Karotz::Color::GREEN
16
+ karotz.speak :text => "build normal"
17
+ sleep(3) # kill session some time after talking
18
+ end
19
+ end
20
+
21
+ task :setup do
22
+ Karotz::Configuration.configure do |config|
23
+ config.install_id = ENV['KAROTZ_INSTALL_ID']
24
+ config.api_key = ENV['KAROTZ_API_KEY']
25
+ config.secret = ENV['KAROTZ_SECRET']
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ module Karotz
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie
4
+ rake_tasks do
5
+ load 'karotz/rails/karotz.rake'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Karotz
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/karotz.rb CHANGED
@@ -4,3 +4,5 @@ require "karotz/multimedia"
4
4
  require "karotz/color"
5
5
  require "karotz/language"
6
6
  require "karotz/client"
7
+
8
+ require "karotz/rails/railtie.rb" if defined?(Rails)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karotz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-28 00:00:00.000000000 Z
12
+ date: 2011-12-30 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &2151815860 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2151815860
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rake
16
- requirement: &2160174660 !ruby/object:Gem::Requirement
27
+ requirement: &2151814740 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,10 +32,10 @@ dependencies:
21
32
  version: '0'
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *2160174660
35
+ version_requirements: *2151814740
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &2160174240 !ruby/object:Gem::Requirement
38
+ requirement: &2151814020 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *2160174240
46
+ version_requirements: *2151814020
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: pry
38
- requirement: &2160173820 !ruby/object:Gem::Requirement
49
+ requirement: &2151829460 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ! '>='
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '0'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *2160173820
57
+ version_requirements: *2151829460
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: guard-rspec
49
- requirement: &2160173400 !ruby/object:Gem::Requirement
60
+ requirement: &2151827220 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ! '>='
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '0'
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *2160173400
68
+ version_requirements: *2151827220
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: webmock
60
- requirement: &2160189360 !ruby/object:Gem::Requirement
71
+ requirement: &2151826380 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *2160189360
79
+ version_requirements: *2151826380
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: vcr
71
- requirement: &2160188940 !ruby/object:Gem::Requirement
82
+ requirement: &2151825580 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ! '>='
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '0'
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *2160188940
90
+ version_requirements: *2151825580
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: httpclient
82
- requirement: &2160188440 !ruby/object:Gem::Requirement
93
+ requirement: &2151824520 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '2.2'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *2160188440
101
+ version_requirements: *2151824520
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: httpi
93
- requirement: &2160187940 !ruby/object:Gem::Requirement
104
+ requirement: &2151823960 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0.9'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *2160187940
112
+ version_requirements: *2151823960
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: crack
104
- requirement: &2160187480 !ruby/object:Gem::Requirement
115
+ requirement: &2151823440 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,7 +120,7 @@ dependencies:
109
120
  version: '0.3'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *2160187480
123
+ version_requirements: *2151823440
113
124
  description: ruby bindings for karotz rest api
114
125
  email:
115
126
  - phoetmail@googlemail.com
@@ -135,6 +146,8 @@ files:
135
146
  - lib/karotz/configuration.rb
136
147
  - lib/karotz/language.rb
137
148
  - lib/karotz/multimedia.rb
149
+ - lib/karotz/rails/karotz.rake
150
+ - lib/karotz/rails/railtie.rb
138
151
  - lib/karotz/version.rb
139
152
  - spec/cassettes/karotz/client_automatic_speach_recognition_asr_should_listen_to_voice.yml
140
153
  - spec/cassettes/karotz/client_automatic_speach_recognition_asr_should_say_something.yml