telapi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/.gitignore +20 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +162 -0
  5. data/Rakefile +1 -0
  6. data/lib/telapi.rb +24 -0
  7. data/lib/telapi/account.rb +14 -0
  8. data/lib/telapi/application.rb +88 -0
  9. data/lib/telapi/available_phone_number.rb +24 -0
  10. data/lib/telapi/call.rb +214 -0
  11. data/lib/telapi/caller_id.rb +16 -0
  12. data/lib/telapi/carrier.rb +16 -0
  13. data/lib/telapi/conference.rb +206 -0
  14. data/lib/telapi/configuration.rb +40 -0
  15. data/lib/telapi/error.rb +22 -0
  16. data/lib/telapi/fraud.rb +79 -0
  17. data/lib/telapi/inbound_xml.rb +36 -0
  18. data/lib/telapi/incoming_phone_number.rb +86 -0
  19. data/lib/telapi/message.rb +47 -0
  20. data/lib/telapi/network.rb +50 -0
  21. data/lib/telapi/notification.rb +29 -0
  22. data/lib/telapi/recording.rb +69 -0
  23. data/lib/telapi/resource.rb +18 -0
  24. data/lib/telapi/resource_collection.rb +38 -0
  25. data/lib/telapi/transcription.rb +44 -0
  26. data/lib/telapi/version.rb +3 -0
  27. data/spec/spec_helper.rb +17 -0
  28. data/spec/support/telapi_helpers.rb +38 -0
  29. data/spec/telapi/account_spec.rb +17 -0
  30. data/spec/telapi/application_spec.rb +69 -0
  31. data/spec/telapi/available_phone_number_spec.rb +27 -0
  32. data/spec/telapi/call_spec.rb +173 -0
  33. data/spec/telapi/caller_id_spec.rb +17 -0
  34. data/spec/telapi/carrier_spec.rb +17 -0
  35. data/spec/telapi/conference_spec.rb +174 -0
  36. data/spec/telapi/configuration_spec.rb +38 -0
  37. data/spec/telapi/error_spec.rb +32 -0
  38. data/spec/telapi/fraud_spec.rb +55 -0
  39. data/spec/telapi/inbound_xml_spec.rb +49 -0
  40. data/spec/telapi/incoming_phone_number_spec.rb +69 -0
  41. data/spec/telapi/message_spec.rb +41 -0
  42. data/spec/telapi/network_spec.rb +80 -0
  43. data/spec/telapi/notification_spec.rb +34 -0
  44. data/spec/telapi/recording_spec.rb +72 -0
  45. data/spec/telapi/resource_collection_spec.rb +64 -0
  46. data/spec/telapi/resource_spec.rb +25 -0
  47. data/spec/telapi/transcription_spec.rb +41 -0
  48. data/telapi-ruby.gemspec +32 -0
  49. metadata +227 -0
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Telapi::Resource do
4
+ let(:initial_hash) { Hash['foo' => 'bar', 'nested' => { 'item' => 'one' }] }
5
+
6
+ context "when initialized using a hash" do
7
+ subject { klass.new(initial_hash) }
8
+
9
+ it "has methods named identically to the initial hash keys" do
10
+ subject.foo.should == 'bar'
11
+ end
12
+
13
+ it "handles nested attributes properly" do
14
+ subject.nested.item.should == 'one'
15
+ end
16
+
17
+ it "returns nil for an unknown method" do
18
+ subject.blah.should be_nil
19
+ end
20
+
21
+ it "can return hash of attributes" do
22
+ subject.attributes.should be_a(Hash)
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe Telapi::Transcription do
4
+ before do
5
+ stub_telapi_request
6
+ set_account_sid_and_auth_token
7
+ end
8
+
9
+ it { should be_kind_of(Telapi::Resource) }
10
+
11
+ describe ".list" do
12
+ before { stub_telapi_request('{ "transcriptions": [] }') }
13
+
14
+ it "calls api via http get and returns a ResourceCollection" do
15
+ api_should_use(:get)
16
+ klass.list.should be_a(Telapi::ResourceCollection)
17
+ end
18
+
19
+ context "when Transcriptions exist" do
20
+ before { stub_telapi_request('{ "transcriptions": [{ "transcription_text": "foo" }] }') }
21
+
22
+ it "has a collection of Transcription objects" do
23
+ klass.list.first.should be_a(klass)
24
+ end
25
+ end
26
+ end
27
+
28
+ describe ".get" do
29
+ it "calls api via http get and returns a Transcription resource" do
30
+ api_should_use(:get)
31
+ klass.get('abc123').should be_a(klass)
32
+ end
33
+ end
34
+
35
+ describe ".transcribe_audio" do
36
+ it "calls api via http post and returns a Transcription resource" do
37
+ api_should_use(:post)
38
+ klass.transcribe_audio('http://audio-url').should be_a(klass)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'telapi/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "telapi"
8
+ gem.version = Telapi::VERSION
9
+ gem.authors = ["Phil Misiowiec"]
10
+ gem.email = ["phil@webficient.com"]
11
+ gem.description = %q{TelAPI wrapper. See www.telapi.com.}
12
+ gem.summary = %q{TelAPI wrapper}
13
+ gem.homepage = "http://github.com/telapi/telapi-ruby"
14
+
15
+ gem.rubyforge_project = "telapi-ruby"
16
+
17
+ gem.files = `git ls-files`.split($/)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.add_dependency 'httparty', '>= 0.8.3'
23
+ gem.add_dependency 'multi_json', '>= 1.3.6'
24
+ gem.add_dependency 'nokogiri', '>= 1.5.5'
25
+ gem.add_dependency 'recursive-open-struct', '>= 0.2.1'
26
+
27
+ gem.add_development_dependency 'rake', '~> 0.9.0'
28
+ gem.add_development_dependency 'rspec', '~> 2.11'
29
+ gem.add_development_dependency 'fakeweb', '>= 1.3.0'
30
+
31
+ gem.extra_rdoc_files = ['LICENSE']
32
+ end
metadata ADDED
@@ -0,0 +1,227 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: telapi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Phil Misiowiec
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: multi_json
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: 1.3.6
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: nokogiri
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.5.5
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.5
62
+ - !ruby/object:Gem::Dependency
63
+ name: recursive-open-struct
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.2.1
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.9.0
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.9.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: rspec
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '2.11'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '2.11'
110
+ - !ruby/object:Gem::Dependency
111
+ name: fakeweb
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.3.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: 1.3.0
126
+ description: TelAPI wrapper. See www.telapi.com.
127
+ email:
128
+ - phil@webficient.com
129
+ executables: []
130
+ extensions: []
131
+ extra_rdoc_files:
132
+ - LICENSE
133
+ files:
134
+ - .gitignore
135
+ - Gemfile
136
+ - LICENSE
137
+ - README.md
138
+ - Rakefile
139
+ - lib/telapi.rb
140
+ - lib/telapi/account.rb
141
+ - lib/telapi/application.rb
142
+ - lib/telapi/available_phone_number.rb
143
+ - lib/telapi/call.rb
144
+ - lib/telapi/caller_id.rb
145
+ - lib/telapi/carrier.rb
146
+ - lib/telapi/conference.rb
147
+ - lib/telapi/configuration.rb
148
+ - lib/telapi/error.rb
149
+ - lib/telapi/fraud.rb
150
+ - lib/telapi/inbound_xml.rb
151
+ - lib/telapi/incoming_phone_number.rb
152
+ - lib/telapi/message.rb
153
+ - lib/telapi/network.rb
154
+ - lib/telapi/notification.rb
155
+ - lib/telapi/recording.rb
156
+ - lib/telapi/resource.rb
157
+ - lib/telapi/resource_collection.rb
158
+ - lib/telapi/transcription.rb
159
+ - lib/telapi/version.rb
160
+ - spec/spec_helper.rb
161
+ - spec/support/telapi_helpers.rb
162
+ - spec/telapi/account_spec.rb
163
+ - spec/telapi/application_spec.rb
164
+ - spec/telapi/available_phone_number_spec.rb
165
+ - spec/telapi/call_spec.rb
166
+ - spec/telapi/caller_id_spec.rb
167
+ - spec/telapi/carrier_spec.rb
168
+ - spec/telapi/conference_spec.rb
169
+ - spec/telapi/configuration_spec.rb
170
+ - spec/telapi/error_spec.rb
171
+ - spec/telapi/fraud_spec.rb
172
+ - spec/telapi/inbound_xml_spec.rb
173
+ - spec/telapi/incoming_phone_number_spec.rb
174
+ - spec/telapi/message_spec.rb
175
+ - spec/telapi/network_spec.rb
176
+ - spec/telapi/notification_spec.rb
177
+ - spec/telapi/recording_spec.rb
178
+ - spec/telapi/resource_collection_spec.rb
179
+ - spec/telapi/resource_spec.rb
180
+ - spec/telapi/transcription_spec.rb
181
+ - telapi-ruby.gemspec
182
+ homepage: http://github.com/telapi/telapi-ruby
183
+ licenses: []
184
+ post_install_message:
185
+ rdoc_options: []
186
+ require_paths:
187
+ - lib
188
+ required_ruby_version: !ruby/object:Gem::Requirement
189
+ none: false
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ! '>='
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ requirements: []
201
+ rubyforge_project: telapi-ruby
202
+ rubygems_version: 1.8.23
203
+ signing_key:
204
+ specification_version: 3
205
+ summary: TelAPI wrapper
206
+ test_files:
207
+ - spec/spec_helper.rb
208
+ - spec/support/telapi_helpers.rb
209
+ - spec/telapi/account_spec.rb
210
+ - spec/telapi/application_spec.rb
211
+ - spec/telapi/available_phone_number_spec.rb
212
+ - spec/telapi/call_spec.rb
213
+ - spec/telapi/caller_id_spec.rb
214
+ - spec/telapi/carrier_spec.rb
215
+ - spec/telapi/conference_spec.rb
216
+ - spec/telapi/configuration_spec.rb
217
+ - spec/telapi/error_spec.rb
218
+ - spec/telapi/fraud_spec.rb
219
+ - spec/telapi/inbound_xml_spec.rb
220
+ - spec/telapi/incoming_phone_number_spec.rb
221
+ - spec/telapi/message_spec.rb
222
+ - spec/telapi/network_spec.rb
223
+ - spec/telapi/notification_spec.rb
224
+ - spec/telapi/recording_spec.rb
225
+ - spec/telapi/resource_collection_spec.rb
226
+ - spec/telapi/resource_spec.rb
227
+ - spec/telapi/transcription_spec.rb