voicemail 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +26 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +3 -0
  5. data/Guardfile +5 -0
  6. data/LICENSE +20 -0
  7. data/README.md +62 -0
  8. data/Rakefile +11 -0
  9. data/lib/voicemail/application_controller.rb +27 -0
  10. data/lib/voicemail/mailbox_controller.rb +56 -0
  11. data/lib/voicemail/mailbox_main_menu_controller.rb +41 -0
  12. data/lib/voicemail/mailbox_messages_controller.rb +55 -0
  13. data/lib/voicemail/mailbox_play_message_controller.rb +69 -0
  14. data/lib/voicemail/mailbox_set_greeting_controller.rb +75 -0
  15. data/lib/voicemail/mailbox_set_pin_controller.rb +45 -0
  16. data/lib/voicemail/plugin.rb +86 -0
  17. data/lib/voicemail/storage.rb +7 -0
  18. data/lib/voicemail/storage_pstore.rb +93 -0
  19. data/lib/voicemail/version.rb +3 -0
  20. data/lib/voicemail/voicemail_controller.rb +32 -0
  21. data/lib/voicemail.rb +14 -0
  22. data/spec/spec_helper.rb +14 -0
  23. data/spec/support/voicemail_controller_spec_helper.rb +39 -0
  24. data/spec/voicemail/mailbox_controller_spec.rb +79 -0
  25. data/spec/voicemail/mailbox_main_menu_controller_spec.rb +35 -0
  26. data/spec/voicemail/mailbox_messages_controller_spec.rb +71 -0
  27. data/spec/voicemail/mailbox_play_message_controller_spec.rb +70 -0
  28. data/spec/voicemail/mailbox_set_greeting_controller_spec.rb +61 -0
  29. data/spec/voicemail/mailbox_set_pin_controller_spec.rb +53 -0
  30. data/spec/voicemail/storage_pstore_spec.rb +45 -0
  31. data/spec/voicemail/storage_spec.rb +13 -0
  32. data/spec/voicemail/voicemail_controller_spec.rb +65 -0
  33. data/tmp/.gitignore +2 -0
  34. data/voicemail.gemspec +29 -0
  35. metadata +200 -0
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe Voicemail::VoicemailController do
4
+ include VoicemailControllerSpecHelper
5
+
6
+ before do
7
+ subject.should_receive(:answer).once
8
+ end
9
+
10
+ describe "#run" do
11
+ context "with a missing mailbox parameter in metadata" do
12
+ let(:metadata) { Hash.new }
13
+
14
+ it "should raise an error if there is no mailbox in the metadata" do
15
+ expect { controller.run }.to raise_error ArgumentError
16
+ end
17
+ end
18
+
19
+ context "with a present mailbox parameter in metadata" do
20
+ context "with an invalid mailbox" do
21
+ let(:mailbox) { nil }
22
+
23
+ it "plays the mailbox not found message and hangs up" do
24
+ should_play config.mailbox_not_found
25
+ subject.should_receive(:hangup).once
26
+ controller.run
27
+ end
28
+ end
29
+
30
+ context "with an existing mailbox" do
31
+ context "without a greeting message" do
32
+ it "plays the default greeting if one is not specified" do
33
+ should_play config.default_greeting
34
+ subject.should_receive(:handle_recording).and_return(true)
35
+ controller.run
36
+ end
37
+ end
38
+
39
+ context "with a specified greeting message" do
40
+ let(:greeting_message) { "Howdy!" }
41
+
42
+ it "plays the specific greeting message" do
43
+ should_play greeting_message
44
+ subject.should_receive(:handle_recording).and_return(true)
45
+ controller.run
46
+ end
47
+ end
48
+
49
+ context "handling a recording" do
50
+ let(:recording_component) { flexmock 'Record' }
51
+ let(:file_path) { "/path/to/file" }
52
+
53
+ it "saves the recording" do
54
+ recording_component.should_receive("complete_event.recording.uri").and_return(file_path)
55
+ subject.should_receive(:record).with(config.recording.to_hash.merge(interruptible: true, max_duration: 30_000, direction: :recv)).and_return(recording_component)
56
+ storage_instance.should_receive(:save_recording).with(mailbox[:id], call.from, file_path)
57
+ should_play
58
+ controller.run
59
+ end
60
+ end
61
+ end
62
+
63
+ end
64
+ end
65
+ end
data/tmp/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *
2
+ !.gitignore
data/voicemail.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "voicemail/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "voicemail"
7
+ s.version = Voicemail::VERSION
8
+ s.authors = ["Luca Pradovera"]
9
+ s.email = ["lpradovera@mojolingo.com"]
10
+ s.homepage = "http://github.com/adhearsion/voicemail"
11
+ s.summary = %q{Voicemail for Adhearsion}
12
+ s.description = %q{A simple, extensible voicemail implementation}
13
+
14
+ s.rubyforge_project = "voicemail"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_runtime_dependency %q<adhearsion>, [">= 2.3.0"]
21
+ s.add_runtime_dependency %q<activesupport>
22
+
23
+ s.add_development_dependency %q<bundler>
24
+ s.add_development_dependency %q<rspec>, [">= 2.5.0"]
25
+ s.add_development_dependency %q<yard>, ["~> 0.6.0"]
26
+ s.add_development_dependency %q<rake>, [">= 0"]
27
+ s.add_development_dependency %q<guard-rspec>
28
+ s.add_development_dependency %q<flexmock>
29
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voicemail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Luca Pradovera
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: adhearsion
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.5.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: flexmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ description: A simple, extensible voicemail implementation
126
+ email:
127
+ - lpradovera@mojolingo.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - .gitignore
133
+ - .rspec
134
+ - Gemfile
135
+ - Guardfile
136
+ - LICENSE
137
+ - README.md
138
+ - Rakefile
139
+ - lib/voicemail.rb
140
+ - lib/voicemail/application_controller.rb
141
+ - lib/voicemail/mailbox_controller.rb
142
+ - lib/voicemail/mailbox_main_menu_controller.rb
143
+ - lib/voicemail/mailbox_messages_controller.rb
144
+ - lib/voicemail/mailbox_play_message_controller.rb
145
+ - lib/voicemail/mailbox_set_greeting_controller.rb
146
+ - lib/voicemail/mailbox_set_pin_controller.rb
147
+ - lib/voicemail/plugin.rb
148
+ - lib/voicemail/storage.rb
149
+ - lib/voicemail/storage_pstore.rb
150
+ - lib/voicemail/version.rb
151
+ - lib/voicemail/voicemail_controller.rb
152
+ - spec/spec_helper.rb
153
+ - spec/support/voicemail_controller_spec_helper.rb
154
+ - spec/voicemail/mailbox_controller_spec.rb
155
+ - spec/voicemail/mailbox_main_menu_controller_spec.rb
156
+ - spec/voicemail/mailbox_messages_controller_spec.rb
157
+ - spec/voicemail/mailbox_play_message_controller_spec.rb
158
+ - spec/voicemail/mailbox_set_greeting_controller_spec.rb
159
+ - spec/voicemail/mailbox_set_pin_controller_spec.rb
160
+ - spec/voicemail/storage_pstore_spec.rb
161
+ - spec/voicemail/storage_spec.rb
162
+ - spec/voicemail/voicemail_controller_spec.rb
163
+ - tmp/.gitignore
164
+ - voicemail.gemspec
165
+ homepage: http://github.com/adhearsion/voicemail
166
+ licenses: []
167
+ metadata: {}
168
+ post_install_message:
169
+ rdoc_options: []
170
+ require_paths:
171
+ - lib
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ requirements: []
183
+ rubyforge_project: voicemail
184
+ rubygems_version: 2.0.0
185
+ signing_key:
186
+ specification_version: 4
187
+ summary: Voicemail for Adhearsion
188
+ test_files:
189
+ - spec/spec_helper.rb
190
+ - spec/support/voicemail_controller_spec_helper.rb
191
+ - spec/voicemail/mailbox_controller_spec.rb
192
+ - spec/voicemail/mailbox_main_menu_controller_spec.rb
193
+ - spec/voicemail/mailbox_messages_controller_spec.rb
194
+ - spec/voicemail/mailbox_play_message_controller_spec.rb
195
+ - spec/voicemail/mailbox_set_greeting_controller_spec.rb
196
+ - spec/voicemail/mailbox_set_pin_controller_spec.rb
197
+ - spec/voicemail/storage_pstore_spec.rb
198
+ - spec/voicemail/storage_spec.rb
199
+ - spec/voicemail/voicemail_controller_spec.rb
200
+ has_rdoc: