twilio-ruby 0.3.0 → 0.3.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.
data/Rakefile CHANGED
@@ -1,8 +1,16 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rspec/core/rake_task'
3
4
 
4
- Spec::Rake::SpecTask.new do |spec|
5
- spec.spec_files = FileList['test/*_spec.rb']
6
- spec.spec_opts << "--color"
7
- spec.libs += ["lib", "test"]
5
+ spec = eval(File.read('twilio-ruby.gemspec'))
6
+
7
+ Rake::GemPackageTask.new(spec) do |p|
8
+ p.gem_spec = spec
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new do |t|
12
+ t.pattern = 'test/*_spec.rb'
13
+ t.rspec_opts = ['-c']
8
14
  end
15
+
16
+ task :default => :spec
@@ -54,7 +54,7 @@ module Twilio
54
54
  end
55
55
 
56
56
  def url_encode(hash)
57
- hash.to_a.map {|pair| pair.map {|e| CGI.escape e.to_s}.join '='}.join '&'
57
+ hash.to_a.map {|p| p.map {|e| CGI.escape e.to_s}.join '='}.join '&'
58
58
  end
59
59
  end
60
60
  end
data/lib/twilio-ruby.rb CHANGED
@@ -10,32 +10,6 @@ require 'base64'
10
10
  require 'twilio-ruby/rest/utils'
11
11
  require 'twilio-ruby/rest/list_resource'
12
12
  require 'twilio-ruby/rest/instance_resource'
13
- require 'twilio-ruby/rest/sandbox/sandbox'
14
- require 'twilio-ruby/rest/accounts/account'
15
- require 'twilio-ruby/rest/accounts/accounts'
16
- require 'twilio-ruby/rest/calls/call'
17
- require 'twilio-ruby/rest/calls/calls'
18
- require 'twilio-ruby/rest/sms/sms'
19
- require 'twilio-ruby/rest/sms/message'
20
- require 'twilio-ruby/rest/sms/messages'
21
- require 'twilio-ruby/rest/outgoing_caller_ids/outgoing_caller_id'
22
- require 'twilio-ruby/rest/outgoing_caller_ids/outgoing_caller_ids'
23
- require 'twilio-ruby/rest/incoming_phone_numbers/incoming_phone_number'
24
- require 'twilio-ruby/rest/incoming_phone_numbers/incoming_phone_numbers'
25
- require 'twilio-ruby/rest/available_phone_numbers/available_phone_number'
26
- require 'twilio-ruby/rest/available_phone_numbers/available_phone_numbers'
27
- require 'twilio-ruby/rest/available_phone_numbers/country'
28
- require 'twilio-ruby/rest/available_phone_numbers/local'
29
- require 'twilio-ruby/rest/available_phone_numbers/toll_free'
30
- require 'twilio-ruby/rest/conferences/conference'
31
- require 'twilio-ruby/rest/conferences/conferences'
32
- require 'twilio-ruby/rest/conferences/participant'
33
- require 'twilio-ruby/rest/conferences/participants'
34
- require 'twilio-ruby/rest/recordings/recording'
35
- require 'twilio-ruby/rest/recordings/recordings'
36
- require 'twilio-ruby/rest/transcriptions/transcription'
37
- require 'twilio-ruby/rest/transcriptions/transcriptions'
38
- require 'twilio-ruby/rest/notifications/notification'
39
- require 'twilio-ruby/rest/notifications/notifications'
13
+ Dir.glob('twilio-ruby/rest/*/*.rb').each {|f| require f}
40
14
  require 'twilio-ruby/rest/client'
41
15
  require 'twilio-ruby/twiml/response'
data/test/twilio_spec.rb CHANGED
@@ -2,46 +2,46 @@ require 'rubygems'
2
2
  require 'twilio-ruby'
3
3
  require 'fakeweb'
4
4
 
5
- describe Twilio::Client do
5
+ describe Twilio::REST::Client do
6
6
  before :all do
7
7
  FakeWeb.register_uri(:any, %r/http:\/\/api.twilio.com\//, :body => '{"message": "You tried to reach Twilio"}')
8
8
  end
9
9
 
10
- it 'should set up a Twilio::Client' do
11
- twilio = Twilio::Client.new('someSid', 'someToken', 'api-version')
10
+ it 'should set up a Twilio::REST::Client' do
11
+ twilio = Twilio::REST::Client.new('someSid', 'someToken', 'api-version')
12
12
  twilio.account_sid.should == 'someSid'
13
13
  twilio.instance_variable_get('@auth_token').should == 'someToken'
14
14
  twilio.api_version.should == 'api-version'
15
15
  end
16
16
 
17
17
  it 'should set up the proper default http ssl connection' do
18
- twilio = Twilio::Client.new('someSid', 'someToken')
18
+ twilio = Twilio::REST::Client.new('someSid', 'someToken')
19
19
  twilio.instance_variable_get('@connection').address.should == 'api.twilio.com'
20
20
  twilio.instance_variable_get('@connection').port.should == 443
21
21
  twilio.instance_variable_get('@connection').use_ssl?.should == true
22
22
  end
23
23
 
24
24
  it 'should set up the proper http ssl connection when a different domain is given' do
25
- twilio = Twilio::Client.new('someSid', 'someToken', '2008-08-01', 'api.faketwilio.com')
25
+ twilio = Twilio::REST::Client.new('someSid', 'someToken', '2008-08-01', 'api.faketwilio.com')
26
26
  twilio.instance_variable_get('@connection').address.should == 'api.faketwilio.com'
27
27
  twilio.instance_variable_get('@connection').port.should == 443
28
28
  twilio.instance_variable_get('@connection').use_ssl?.should == true
29
29
  end
30
30
 
31
31
  it 'should set up an accounts resources object' do
32
- twilio = Twilio::Client.new('someSid', 'someToken')
32
+ twilio = Twilio::REST::Client.new('someSid', 'someToken')
33
33
  twilio.respond_to?(:accounts).should == true
34
34
  twilio.accounts.instance_variable_get('@uri').should == '/2010-04-01/Accounts'
35
35
  end
36
36
 
37
37
  it 'should set up an account object with the given sid' do
38
- twilio = Twilio::Client.new('someSid', 'someToken')
38
+ twilio = Twilio::REST::Client.new('someSid', 'someToken')
39
39
  twilio.respond_to?(:account).should == true
40
40
  twilio.account.instance_variable_get('@uri').should == '/2010-04-01/Accounts/someSid'
41
41
  end
42
42
 
43
43
  it 'should convert all parameter names to Twilio-style names' do
44
- twilio = Twilio::Client.new('someSid', 'someToken')
44
+ twilio = Twilio::REST::Client.new('someSid', 'someToken')
45
45
  untwilified = {:sms_url => 'someUrl', 'voiceFallbackUrl' => 'anotherUrl',
46
46
  'Status_callback' => 'yetAnotherUrl'}
47
47
  twilified = {:SmsUrl => 'someUrl', :VoiceFallbackUrl => 'anotherUrl',
@@ -52,87 +52,87 @@ describe Twilio::Client do
52
52
  end
53
53
  end
54
54
 
55
- describe Twilio::Account do
55
+ describe Twilio::REST::Account do
56
56
  it 'should set up an incoming phone numbers resources object' do
57
- account = Twilio::Account.new('someUri', 'someClient')
57
+ account = Twilio::REST::Account.new('someUri', 'someClient')
58
58
  account.respond_to?(:incoming_phone_numbers).should == true
59
59
  account.incoming_phone_numbers.instance_variable_get('@uri').should == 'someUri/IncomingPhoneNumbers'
60
60
  end
61
61
 
62
62
  it 'should set up an available phone numbers resources object' do
63
- account = Twilio::Account.new('someUri', 'someClient')
63
+ account = Twilio::REST::Account.new('someUri', 'someClient')
64
64
  account.respond_to?(:available_phone_numbers).should == true
65
65
  account.available_phone_numbers.instance_variable_get('@uri').should == 'someUri/AvailablePhoneNumbers'
66
66
  end
67
67
 
68
68
  it 'should set up an outgoing caller ids resources object' do
69
- account = Twilio::Account.new('someUri', 'someClient')
69
+ account = Twilio::REST::Account.new('someUri', 'someClient')
70
70
  account.respond_to?(:outgoing_caller_ids).should == true
71
71
  account.outgoing_caller_ids.instance_variable_get('@uri').should == 'someUri/OutgoingCallerIds'
72
72
  end
73
73
 
74
74
  it 'should set up a calls resources object' do
75
- account = Twilio::Account.new('someUri', 'someClient')
75
+ account = Twilio::REST::Account.new('someUri', 'someClient')
76
76
  account.respond_to?(:calls).should == true
77
77
  account.calls.instance_variable_get('@uri').should == 'someUri/Calls'
78
78
  end
79
79
 
80
80
  it 'should set up a conferences resources object' do
81
- account = Twilio::Account.new('someUri', 'someClient')
81
+ account = Twilio::REST::Account.new('someUri', 'someClient')
82
82
  account.respond_to?(:conferences).should == true
83
83
  account.conferences.instance_variable_get('@uri').should == 'someUri/Conferences'
84
84
  end
85
85
 
86
- it 'should set up a sms messages resources object' do
87
- account = Twilio::Account.new('someUri', 'someClient')
88
- account.respond_to?(:sms_messages).should == true
89
- account.sms_messages.instance_variable_get('@uri').should == 'someUri/SMS/Messages'
86
+ it 'should set up a sms resource object' do
87
+ account = Twilio::REST::Account.new('someUri', 'someClient')
88
+ account.respond_to?(:sms).should == true
89
+ account.sms.instance_variable_get('@uri').should == 'someUri/SMS'
90
90
  end
91
91
 
92
92
  it 'should set up a recordings resources object' do
93
- account = Twilio::Account.new('someUri', 'someClient')
93
+ account = Twilio::REST::Account.new('someUri', 'someClient')
94
94
  account.respond_to?(:recordings).should == true
95
95
  account.recordings.instance_variable_get('@uri').should == 'someUri/Recordings'
96
96
  end
97
97
 
98
98
  it 'should set up a transcriptions resources object' do
99
- account = Twilio::Account.new('someUri', 'someClient')
99
+ account = Twilio::REST::Account.new('someUri', 'someClient')
100
100
  account.respond_to?(:transcriptions).should == true
101
101
  account.transcriptions.instance_variable_get('@uri').should == 'someUri/Transcriptions'
102
102
  end
103
103
 
104
104
  it 'should set up a notifications resources object' do
105
- account = Twilio::Account.new('someUri', 'someClient')
105
+ account = Twilio::REST::Account.new('someUri', 'someClient')
106
106
  account.respond_to?(:notifications).should == true
107
107
  account.notifications.instance_variable_get('@uri').should == 'someUri/Notifications'
108
108
  end
109
109
  end
110
110
 
111
- describe Twilio::Call do
111
+ describe Twilio::REST::Call do
112
112
  it 'should set up a recordings resources object' do
113
- call = Twilio::Call.new('someUri', 'someClient')
113
+ call = Twilio::REST::Call.new('someUri', 'someClient')
114
114
  call.respond_to?(:recordings).should == true
115
115
  call.recordings.instance_variable_get('@uri').should == 'someUri/Recordings'
116
116
  end
117
117
 
118
118
  it 'should set up a recordings resources object' do
119
- call = Twilio::Call.new('someUri', 'someClient')
119
+ call = Twilio::REST::Call.new('someUri', 'someClient')
120
120
  call.respond_to?(:transcriptions).should == true
121
121
  call.transcriptions.instance_variable_get('@uri').should == 'someUri/Transcriptions'
122
122
  end
123
123
  end
124
124
 
125
- describe Twilio::Conference do
125
+ describe Twilio::REST::Conference do
126
126
  it 'should set up a participants resources object' do
127
- call = Twilio::Conference.new('someUri', 'someClient')
127
+ call = Twilio::REST::Conference.new('someUri', 'someClient')
128
128
  call.respond_to?(:participants).should == true
129
129
  call.participants.instance_variable_get('@uri').should == 'someUri/Participants'
130
130
  end
131
131
  end
132
132
 
133
- describe Twilio::Recording do
133
+ describe Twilio::REST::Recording do
134
134
  it 'should set up a transcriptions resources object' do
135
- call = Twilio::Recording.new('someUri', 'someClient')
135
+ call = Twilio::REST::Recording.new('someUri', 'someClient')
136
136
  call.respond_to?(:transcriptions).should == true
137
137
  call.transcriptions.instance_variable_get('@uri').should == 'someUri/Transcriptions'
138
138
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Benton
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-14 00:00:00 -07:00
18
+ date: 2011-03-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  requirements: []
127
127
 
128
128
  rubyforge_project:
129
- rubygems_version: 1.5.0
129
+ rubygems_version: 1.6.2
130
130
  signing_key:
131
131
  specification_version: 3
132
132
  summary: A simple library for communicating with the Twilio REST API