tropo-provisioning 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+
2
+ class TropoProvisioning
3
+ # Current gem version
4
+ VERSION = "0.0.22"
5
+ end
@@ -1,60 +1,255 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "TropoProvisioning" do
4
- before(:all) do
5
- @app_details = { :voiceUrl => 'http://mydomain.com/voice_script.rb',
6
- :partition => 'staging',
7
- :messagingUrl => 'http://mydomain.com/message_script.rb',
8
- :platform => 'scripting' }
9
- @tp = TropoProvisioning.new('jsgoecke', 'test123')
4
+
5
+ let(:existing_user) do
6
+ { "city" => "Orlando",
7
+ "address" => "1234 Anywhere St",
8
+ "href" => "https://api-smsified-eng.voxeo.net/v1/users/12345",
9
+ "lastName" => "User",
10
+ "address2" => "Unit 1337",
11
+ "joinDate" => "2010-05-17T18:26:07.217+0000",
12
+ "country" => "USA",
13
+ "username" => "foo",
14
+ "phoneNumber" => "4075551212",
15
+ "id" => "12345",
16
+ "postalCode" => "32801",
17
+ "jobTitle" => "Technical Writer",
18
+ "firstName" => "Tropo",
19
+ "organization" => "Voxeo",
20
+ "status" => "active",
21
+ "email" => "support@tropo.com"
22
+ }
10
23
  end
11
24
 
12
- after(:all) do
13
-
25
+ let(:exchanges) do
26
+ '[
27
+ {
28
+ "prefix":"1407",
29
+ "city":"Orlando",
30
+ "state":"FL",
31
+ "country": "United States"
32
+ },
33
+ {
34
+ "prefix":"1312",
35
+ "city":"Chicago",
36
+ "state":"IL",
37
+ "country":"United States"
38
+ },
39
+ {
40
+ "prefix":"1303",
41
+ "city":"Denver",
42
+ "state":"CO",
43
+ "country":"United States"
44
+ },
45
+ {
46
+ "prefix":"1310",
47
+ "city": "Los Angeles",
48
+ "state":"CA",
49
+ "country":"United States"
50
+ },
51
+ {
52
+ "prefix": "1412",
53
+ "city":"Pittsburgh",
54
+ "state":"PA",
55
+ "country": "United States"
56
+ },
57
+ {
58
+ "prefix":"1415",
59
+ "city":"San Francisco",
60
+ "state": "CA",
61
+ "country":"United States"
62
+ },
63
+ {
64
+ "prefix":"1206",
65
+ "city": "Seattle",
66
+ "state":"WA",
67
+ "country":"United States"
68
+ },
69
+ {
70
+ "prefix": "1301",
71
+ "city":"Washington",
72
+ "state":"DC",
73
+ "country": "United States"
74
+ }
75
+ ]'
76
+ end
77
+
78
+ let(:application) do
79
+ { "voiceUrl" => "http://webhosting.voxeo.net/1234/www/simple.js",
80
+ "name" => "API Test",
81
+ "href" => "http://api.tropo.com/v1/applications/108000",
82
+ "partition" => "staging",
83
+ "platform" => "scripting" }
84
+ end
85
+
86
+ let(:tropo_provisioning) do
87
+ TropoProvisioning.new('jsgoecke', 'test123')
88
+ end
89
+
90
+ let(:app_details) do
91
+ { :voiceUrl => 'http://mydomain.com/voice_script.rb',
92
+ :partition => 'staging',
93
+ :messagingUrl => 'http://mydomain.com/message_script.rb',
94
+ :platform => 'scripting' }
14
95
  end
15
96
 
16
97
  it "should create an application" do
17
- result = @tp.create_application(@app_details.merge!({ :name => 'Live API Test' }))
98
+ # Get a specific user by username
99
+ FakeWeb.register_uri(:get,
100
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/users/jsgoecke",
101
+ :body => ActiveSupport::JSON.encode(existing_user),
102
+ :content_type => "application/json",
103
+ :status => ["200", "OK"])
104
+
105
+ # Create an application
106
+ FakeWeb.register_uri(:post,
107
+ %r|http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications|,
108
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/provisioning/applications/#{APPLICATION_ID}" }),
109
+ :status => ["200", "OK"])
110
+
111
+
112
+ result = tropo_provisioning.create_application(app_details.merge!({ :name => 'Live API Test' }))
18
113
  result.href.should =~ /^http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}$/
19
114
  result.application_id.should =~ /\d{1,7}/
20
- APPLICATION_ID = result.application_id
115
+ result.application_id.should.eql?(APPLICATION_ID)
21
116
  end
22
117
 
23
118
  it "should get a list of exchanges" do
24
- exchanges = @tp.exchanges
25
- exchanges[0].city.should == 'Houston'
119
+ # Exchanges
120
+ FakeWeb.register_uri(:get,
121
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/exchanges",
122
+ :body => exchanges,
123
+ :status => ["200", "OK"],
124
+ :content_type => "application/json")
125
+
126
+ exchanges = tropo_provisioning.exchanges
127
+ exchanges[0].city.should eql('Orlando')
26
128
  end
27
129
 
28
130
  it "should add a phone, IM and token address to the application" do
29
- result = @tp.create_address(APPLICATION_ID, { :type => 'number', :prefix => @tp.exchanges[0].prefix })
30
- result.href.should =~ /http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}\/addresses\/number\/\d{1,20}/
131
+ # Get a specific user by username
132
+ FakeWeb.register_uri(:get,
133
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/users/jsgoecke",
134
+ :body => ActiveSupport::JSON.encode(existing_user),
135
+ :content_type => "application/json",
136
+ :status => ["200", "OK"])
137
+
138
+ # Exchanges
139
+ FakeWeb.register_uri(:get,
140
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/exchanges",
141
+ :body => exchanges,
142
+ :status => ["200", "OK"],
143
+ :content_type => "application/json")
144
+
145
+ # Get a address that is a number
146
+ FakeWeb.register_uri(:post,
147
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/108016/addresses",
148
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/108000/addresses/number/7202551912" }),
149
+ :content_type => "application/json")
31
150
 
32
- result = @tp.create_address(APPLICATION_ID, { :type => 'jabber', :username => "liveapitest#{rand(100000).to_s}@bot.im" } )
33
- result.href.should =~ /http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}\/addresses\/jabber\/\w{10,16}@bot.im/
151
+ result = tropo_provisioning.create_address(APPLICATION_ID, { :type => 'number', :prefix => tropo_provisioning.exchanges[0].prefix })
152
+ result.href.should =~ /http:\/\/api.tropo.com\/v1\/applications\/\d{1,7}\/addresses\/number\/\d{1,20}/
34
153
 
35
- result = @tp.create_address(APPLICATION_ID, { :type => 'token', :channel => 'voice' } )
36
- result.href.should =~ /http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}\/addresses\/token\/\w{88}/
154
+ end
155
+
156
+ it "should add an IM token address to the application" do
157
+ # Get a specific user by username
158
+ FakeWeb.register_uri(:get,
159
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/users/jsgoecke",
160
+ :body => ActiveSupport::JSON.encode(existing_user),
161
+ :content_type => "application/json",
162
+ :status => ["200", "OK"])
163
+
164
+ # Exchanges
165
+ FakeWeb.register_uri(:get,
166
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/exchanges",
167
+ :body => exchanges,
168
+ :status => ["200", "OK"],
169
+ :content_type => "application/json")
170
+
171
+ # Get a address that is a number
172
+ FakeWeb.register_uri(:post,
173
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/#{APPLICATION_ID}/addresses",
174
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/#{APPLICATION_ID}/addresses/jabber/appsdsdsdasd@bot.im" }),
175
+ :content_type => "application/json")
176
+
177
+ result = tropo_provisioning.create_address(APPLICATION_ID, { :type => 'jabber', :username => "liveapitest#{rand(100000).to_s}@bot.im" } )
178
+ result.href.should =~ /http:\/\/api.tropo.com\/v1\/applications\/#{APPLICATION_ID}\/addresses\/jabber\/\w{10,16}@bot.im/
179
+
180
+ end
181
+
182
+ it "should add a token to the application" do
183
+ # Get a specific user by username
184
+ FakeWeb.register_uri(:get,
185
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/users/jsgoecke",
186
+ :body => ActiveSupport::JSON.encode(existing_user),
187
+ :content_type => "application/json",
188
+ :status => ["200", "OK"])
189
+
190
+ # Exchanges
191
+ FakeWeb.register_uri(:get,
192
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/exchanges",
193
+ :body => exchanges,
194
+ :status => ["200", "OK"],
195
+ :content_type => "application/json")
196
+
197
+ # Get a address that is a number
198
+ FakeWeb.register_uri(:post,
199
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/#{APPLICATION_ID}/addresses",
200
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/#{APPLICATION_ID}/addresses/token/"+("w"*88) }),
201
+ :content_type => "application/json")
202
+ result = tropo_provisioning.create_address(APPLICATION_ID, { :type => 'token', :channel => 'voice' } )
203
+ result.href.should =~ /http:\/\/api.tropo.com\/v1\/applications\/#{APPLICATION_ID}\/addresses\/token\/\w{88}/
37
204
  end
38
205
 
39
206
  it "should update the application" do
40
207
  # First, get the application in question
41
- app_data = @tp.application(APPLICATION_ID)
208
+
209
+ # A specific application
210
+ FakeWeb.register_uri(:get,
211
+ "http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/#{APPLICATION_ID}",
212
+ :body => ActiveSupport::JSON.encode(application),
213
+ :content_type => "application/json")
214
+
215
+ app_data = tropo_provisioning.application(APPLICATION_ID)
42
216
  app_data['name'] = 'Live API Test Update'
43
- result = @tp.update_application(APPLICATION_ID, app_data)
44
- result.href.should =~ /^http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}$/
217
+
218
+ # Update a specific application
219
+ FakeWeb.register_uri(:put,
220
+ %r|http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/#{APPLICATION_ID}|,
221
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/#{APPLICATION_ID}" }),
222
+ :status => ["200", "OK"])
223
+
224
+ result = tropo_provisioning.update_application(APPLICATION_ID, app_data)
225
+ result.href.should =~ /^http:\/\/api.tropo.com\/v1\/applications\/#{APPLICATION_ID}$/
45
226
  end
46
227
 
47
228
  it "should move a address to a new application and then back" do
48
- new_app = @tp.create_application(@app_details.merge!({ :name => 'Live API Test New' }))
229
+ pending
230
+ # Create an application
231
+ FakeWeb.register_uri(:post,
232
+ %r|http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications|,
233
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/provisioning/applications/#{APPLICATION_ID}" }),
234
+ :status => ["200", "OK"])
235
+
236
+ new_app = tropo_provisioning.create_application(app_details.merge!({ :name => 'Live API Test New' }))
49
237
  new_app.href.should =~ /^http:\/\/api.tropo.com\/provisioning\/applications\/\d{1,7}$/
50
- new_address = @tp.create_address(new_app.application_id, { :type => 'number', :prefix => @tp.exchanges[0]['prefix'] })
238
+
239
+ new_address = tropo_provisioning.create_address(new_app.application_id, { :type => 'number', :prefix => tropo_provisioning.exchanges[0]['prefix'] })
51
240
 
52
- result = @tp.move_address({ :from => APPLICATION_ID,
241
+ # Update a specific application
242
+ FakeWeb.register_uri(:post,
243
+ %r|http://#{USERNAME}:#{PASSWORD}@api.tropo.com/v1/applications/#{APPLICATION_ID}/addresses|,
244
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/#{APPLICATION_ID}" }),
245
+ :status => ["200", "OK"])
246
+
247
+ result = tropo_provisioning.move_address({ :from => APPLICATION_ID,
53
248
  :to => new_app,
54
249
  :address => new_address.address })
55
250
  result.should == nil
56
251
 
57
- result = @tp.move_address({ :from => new_app,
252
+ result = tropo_provisioning.move_address({ :from => new_app,
58
253
  :to => APPLICATION_ID,
59
254
  :address => new_address.address })
60
255
  result.should == nil
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,6 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
1
  require 'tropo-provisioning'
4
- require 'rspec'
5
- require 'rspec/autorun'
6
2
  require 'fakeweb'
7
3
 
8
- RSpec.configure do |config|
9
-
10
- end
4
+ USERNAME = "jsgoecke"
5
+ PASSWORD = "test123"
6
+ APPLICATION_ID = 108016
@@ -1,27 +1,34 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  # These tests are all local unit tests
4
4
  FakeWeb.allow_net_connect = false
5
5
 
6
6
  describe "TropoProvisioning" do
7
+ let(:applications) do
8
+ [ { "region" => "I-US",
9
+ "city" => "iNum US",
10
+ "number" => "883510001812716",
11
+ "href" => "http://api.tropo.com/v1/applications/108000/addresses/number/883510001812716",
12
+ "prefix" => "008",
13
+ "type" => "number" },
14
+ { "number" => "9991436301",
15
+ "href" => "http://api.tropo.com/v1/applications/108000/addresses/pin/9991436300",
16
+ "type" => "pin" },
17
+ { "href" => "http://api.tropo.com/v1/applications/108000/addresses/jabber/xyz123",
18
+ "nickname" => "",
19
+ "username" => "xyz123",
20
+ "type" => "jabber" },
21
+ { "href" => "http://api.tropo.com/v1/applications/108000/addresses/jabber/xyz123",
22
+ "nickname" => "",
23
+ "username" => "9991436300",
24
+ "type" => "pin" },
25
+ { "href" => "http://api.tropo.com/v1/applications/108000/addresses/token/a1b2c3d4",
26
+ "nickname" => "",
27
+ "username" => "a1b2c3d4",
28
+ "type" => "token" } ]
29
+ end
30
+
7
31
  before(:all) do
8
- @applications = [ { "voiceUrl" => "http://webhosting.voxeo.net/1234/www/simple.js",
9
- "name" => "API Test",
10
- "href" => "http://api.tropo.com/v1/applications/108000",
11
- "partition" => "staging",
12
- "platform" => "scripting" },
13
- { "voiceUrl" => "http://hosting.tropo.com/1234/www/simon.rb",
14
- "name" => "Simon Game",
15
- "href" => "http://api.tropo.com/v1/applications/105838",
16
- "partition" => "staging",
17
- "messagingUrl" => "http://hosting.tropo.com/1234/www/simon.rb",
18
- "platform" => "scripting" },
19
- { "voiceUrl" => "http://webhosting.voxeo.net/1234/www/simple.js",
20
- "name" => "Foobar",
21
- "href" => "http://api.tropo.com/v1/applications/108002",
22
- "partition" => "staging",
23
- "platform" => "scripting" } ]
24
-
25
32
  @addresses = [ { "region" => "I-US",
26
33
  "city" => "iNum US",
27
34
  "number" => "883510001812716",
@@ -44,56 +51,6 @@ describe "TropoProvisioning" do
44
51
  "username" => "a1b2c3d4",
45
52
  "type" => "token" } ]
46
53
 
47
- @exchanges = '[
48
- {
49
- "prefix":"1407",
50
- "city":"Orlando",
51
- "state":"FL",
52
- "country": "United States"
53
- },
54
- {
55
- "prefix":"1312",
56
- "city":"Chicago",
57
- "state":"IL",
58
- "country":"United States"
59
- },
60
- {
61
- "prefix":"1303",
62
- "city":"Denver",
63
- "state":"CO",
64
- "country":"United States"
65
- },
66
- {
67
- "prefix":"1310",
68
- "city": "Los Angeles",
69
- "state":"CA",
70
- "country":"United States"
71
- },
72
- {
73
- "prefix": "1412",
74
- "city":"Pittsburgh",
75
- "state":"PA",
76
- "country": "United States"
77
- },
78
- {
79
- "prefix":"1415",
80
- "city":"San Francisco",
81
- "state": "CA",
82
- "country":"United States"
83
- },
84
- {
85
- "prefix":"1206",
86
- "city": "Seattle",
87
- "state":"WA",
88
- "country":"United States"
89
- },
90
- {
91
- "prefix": "1301",
92
- "city":"Washington",
93
- "state":"DC",
94
- "country": "United States"
95
- }
96
- ]'
97
54
 
98
55
  @new_user = { 'user_id' => "12345", 'href' => "http://api.tropo.com/v1/users/12345", 'confirmation_key' => '1234' }
99
56
  @new_user_json = ActiveSupport::JSON.encode({ 'user_id' => "12345", 'href' => "http://api.tropo.com/v1/users/12345", 'confirmationKey' => '1234' })
@@ -211,13 +168,13 @@ describe "TropoProvisioning" do
211
168
  # A specific application
212
169
  FakeWeb.register_uri(:get,
213
170
  "http://foo:bar@api.tropo.com/v1/applications/108000",
214
- :body => ActiveSupport::JSON.encode(@applications[0]),
171
+ :body => ActiveSupport::JSON.encode(applications[0]),
215
172
  :content_type => "application/json")
216
173
 
217
174
  # Applications
218
175
  FakeWeb.register_uri(:get,
219
176
  %r|http://foo:bar@api.tropo.com/v1/applications|,
220
- :body => ActiveSupport::JSON.encode(@applications),
177
+ :body => ActiveSupport::JSON.encode(applications),
221
178
  :content_type => "application/json")
222
179
 
223
180
  # Create an application
@@ -296,7 +253,7 @@ describe "TropoProvisioning" do
296
253
  # Exchanges
297
254
  FakeWeb.register_uri(:get,
298
255
  "http://foo:bar@api.tropo.com/v1/exchanges",
299
- :body => @exchanges,
256
+ :body => exchanges,
300
257
  :status => ["200", "OK"],
301
258
  :content_type => "application/json")
302
259
 
@@ -606,12 +563,65 @@ describe "TropoProvisioning" do
606
563
  :status => ["200", "OK"])
607
564
  end
608
565
 
609
- before(:each) do
610
- @tropo_provisioning = TropoProvisioning.new('foo', 'bar')
566
+ let(:tropo_provisioning) do
567
+ TropoProvisioning.new('foo', 'bar')
568
+ end
569
+
570
+ let(:exchanges) do
571
+ '[
572
+ {
573
+ "prefix":"1407",
574
+ "city":"Orlando",
575
+ "state":"FL",
576
+ "country": "United States"
577
+ },
578
+ {
579
+ "prefix":"1312",
580
+ "city":"Chicago",
581
+ "state":"IL",
582
+ "country":"United States"
583
+ },
584
+ {
585
+ "prefix":"1303",
586
+ "city":"Denver",
587
+ "state":"CO",
588
+ "country":"United States"
589
+ },
590
+ {
591
+ "prefix":"1310",
592
+ "city": "Los Angeles",
593
+ "state":"CA",
594
+ "country":"United States"
595
+ },
596
+ {
597
+ "prefix": "1412",
598
+ "city":"Pittsburgh",
599
+ "state":"PA",
600
+ "country": "United States"
601
+ },
602
+ {
603
+ "prefix":"1415",
604
+ "city":"San Francisco",
605
+ "state": "CA",
606
+ "country":"United States"
607
+ },
608
+ {
609
+ "prefix":"1206",
610
+ "city": "Seattle",
611
+ "state":"WA",
612
+ "country":"United States"
613
+ },
614
+ {
615
+ "prefix": "1301",
616
+ "city":"Washington",
617
+ "state":"DC",
618
+ "country": "United States"
619
+ }
620
+ ]'
611
621
  end
612
622
 
613
623
  it "should create a TropoProvisioning object" do
614
- @tropo_provisioning.instance_of?(TropoProvisioning).should == true
624
+ tropo_provisioning.instance_of?(TropoProvisioning).should == true
615
625
  end
616
626
 
617
627
  describe 'authentication' do
@@ -631,7 +641,7 @@ describe "TropoProvisioning" do
631
641
  it "should not provide a token for an existing account if wrong credentials" do
632
642
  pending('Need to work on tests for the new account')
633
643
  begin
634
- result = @tropo_provisioning.account("foobar7474", 'fooeyfooey')
644
+ result = tropo_provisioning.account("foobar7474", 'fooeyfooey')
635
645
  rescue => e
636
646
  e.to_s.should == "403 - Invalid Login."
637
647
  end
@@ -639,27 +649,27 @@ describe "TropoProvisioning" do
639
649
 
640
650
  it "should provide a token for an existing account" do
641
651
  pending('Need to work on tests for the new account')
642
- result = @tropo_provisioning.account("foobar7474", 'fooey')
652
+ result = tropo_provisioning.account("foobar7474", 'fooey')
643
653
  result.should == @list_account
644
654
  end
645
655
  end
646
656
 
647
657
  describe 'applications' do
648
658
  it "should get a list of applications" do
649
- applications = []
650
- @applications.each { |app| applications << app.merge({ 'application_id' => app['href'].split('/').last }) }
659
+ _applications = []
660
+ applications.each { |app| _applications << app.merge({ 'application_id' => app['href'].split('/').last }) }
651
661
 
652
- @tropo_provisioning.applications.should == applications
662
+ tropo_provisioning.applications.should == _applications
653
663
  end
654
664
 
655
665
  it "should get a specific application" do
656
- response = @tropo_provisioning.application '108000'
657
- response['href'].should == @applications[0]['href']
666
+ response = tropo_provisioning.application '108000'
667
+ response['href'].should == applications[0]['href']
658
668
  end
659
669
 
660
670
  it "should raise ArgumentErrors if appropriate arguments are not specified" do
661
671
  begin
662
- @tropo_provisioning.create_application({ :foo => 'bar' })
672
+ tropo_provisioning.create_application({ :foo => 'bar' })
663
673
  rescue => e
664
674
  e.to_s.should == ':name is a required parameter'
665
675
  end
@@ -667,7 +677,7 @@ describe "TropoProvisioning" do
667
677
 
668
678
  it "should raise ArgumentErrors if appropriate values are not passed" do
669
679
  begin
670
- @tropo_provisioning.create_application({ :name => 'foobar',
680
+ tropo_provisioning.create_application({ :name => 'foobar',
671
681
  :partition => 'foobar',
672
682
  :platform => 'foobar',
673
683
  :messagingUrl => 'http://foobar' })
@@ -676,18 +686,18 @@ describe "TropoProvisioning" do
676
686
  end
677
687
 
678
688
  begin
679
- @tropo_provisioning.create_application({ :name => 'foobar',
689
+ tropo_provisioning.create_application({ :name => 'foobar',
680
690
  :partition => 'foobar',
681
691
  :platform => 'scripting',
682
692
  :messagingUrl => 'http://foobar' })
683
693
  rescue => e
684
- e.to_s.should == ":partiion must be 'staging' or 'production'"
694
+ e.to_s.should == ":partition must be 'staging' or 'production'"
685
695
  end
686
696
  end
687
697
 
688
698
  it "should receive an href back when we create a new application receiving an href back" do
689
699
  # With camelCase
690
- result = @tropo_provisioning.create_application({ :name => 'foobar',
700
+ result = tropo_provisioning.create_application({ :name => 'foobar',
691
701
  :partition => 'production',
692
702
  :platform => 'scripting',
693
703
  :messagingUrl => 'http://foobar' })
@@ -695,7 +705,7 @@ describe "TropoProvisioning" do
695
705
  result.application_id.should == '108016'
696
706
 
697
707
  # With underscores
698
- result = @tropo_provisioning.create_application({ :name => 'foobar',
708
+ result = tropo_provisioning.create_application({ :name => 'foobar',
699
709
  :partition => 'production',
700
710
  :platform => 'scripting',
701
711
  :messaging_url => 'http://foobar' })
@@ -705,14 +715,14 @@ describe "TropoProvisioning" do
705
715
 
706
716
  it "should receive an href back when we update an application receiving an href back" do
707
717
  # With camelCase
708
- result = @tropo_provisioning.update_application('108000', { :name => 'foobar',
718
+ result = tropo_provisioning.update_application('108000', { :name => 'foobar',
709
719
  :partition => 'production',
710
720
  :platform => 'scripting',
711
721
  :messagingUrl => 'http://foobar' })
712
722
  result.href.should == "http://api.tropo.com/v1/applications/108016"
713
723
 
714
724
  # With underscore
715
- result = @tropo_provisioning.update_application('108000', { :name => 'foobar',
725
+ result = tropo_provisioning.update_application('108000', { :name => 'foobar',
716
726
  :partition => 'production',
717
727
  :platform => 'scripting',
718
728
  :messaging_url => 'http://foobar' })
@@ -720,79 +730,79 @@ describe "TropoProvisioning" do
720
730
  end
721
731
 
722
732
  it "should delete an application" do
723
- result = @tropo_provisioning.delete_application('108000')
733
+ result = tropo_provisioning.delete_application('108000')
724
734
  result.message.should == 'delete successful'
725
735
  end
726
736
  end
727
737
 
728
738
  describe 'addresses' do
729
739
  it "should list all of the addresses available for an application" do
730
- result = @tropo_provisioning.addresses('108000')
740
+ result = tropo_provisioning.addresses('108000')
731
741
  result.should == @addresses
732
742
  end
733
743
 
734
744
  it "should list a single address when requested with a number for numbers" do
735
- result = @tropo_provisioning.address('108000', '883510001812716')
745
+ result = tropo_provisioning.address('108000', '883510001812716')
736
746
  result.should == @addresses[0]
737
747
  end
738
748
 
739
749
  it "should list a single address of the appropriate type when requested" do
740
750
  # First a number
741
- result = @tropo_provisioning.address('108000', '883510001812716')
751
+ result = tropo_provisioning.address('108000', '883510001812716')
742
752
  result.should == @addresses[0]
743
753
 
744
754
  # Then an IM username
745
- result = @tropo_provisioning.address('108000', 'xyz123')
755
+ result = tropo_provisioning.address('108000', 'xyz123')
746
756
  result.should == @addresses[2]
747
757
 
748
758
  # Then a pin
749
- result = @tropo_provisioning.address('108000', '9991436300')
759
+ result = tropo_provisioning.address('108000', '9991436300')
750
760
  result.should == @addresses[3]
751
761
 
752
762
  # Then a token
753
- result = @tropo_provisioning.address('108000', 'a1b2c3d4')
763
+ result = tropo_provisioning.address('108000', 'a1b2c3d4')
754
764
  result.should == @addresses[4]
755
765
  end
756
766
 
757
767
  it "should generate an error of the addition of the address does not have a required field" do
758
768
  # Add a address without a type
759
769
  begin
760
- @tropo_provisioning.create_address('108000')
770
+ tropo_provisioning.create_address('108000')
761
771
  rescue => e
762
772
  e.to_s.should == ":type is a required parameter"
763
773
  end
764
774
 
765
775
  # Add a number without a prefix
766
776
  begin
767
- @tropo_provisioning.create_address('108000', { :type => 'number' })
777
+ tropo_provisioning.create_address('108000', { :type => 'number' })
768
778
  rescue => e
769
779
  e.to_s.should == ":prefix required to add a number address"
770
780
  end
771
781
 
772
782
  # Add a jabber without a username
773
783
  begin
774
- @tropo_provisioning.create_address('108000', { :type => 'jabber' })
784
+ tropo_provisioning.create_address('108000', { :type => 'jabber' })
775
785
  rescue => e
776
786
  e.to_s.should == ":username is a required parameter"
777
787
  end
778
788
 
779
789
  # Add an aim without a password
780
790
  begin
781
- @tropo_provisioning.create_address('108000', { :type => 'aim', :username => 'joeblow@aim.com' })
791
+ tropo_provisioning.create_address('108000', { :type => 'aim', :username => 'joeblow@aim.com' })
782
792
  rescue => e
783
793
  e.to_s.should == ":password is a required parameter"
784
794
  end
785
795
 
786
796
  # Add a token without a channel
787
797
  begin
788
- @tropo_provisioning.create_address('108000', { :type => 'token' })
798
+ tropo_provisioning.create_address('108000', { :type => 'token' })
789
799
  rescue => e
790
800
  e.to_s.should == ":channel is a required parameter"
791
801
  end
792
802
 
793
803
  # Add a token with an invalid channel type
794
804
  begin
795
- @tropo_provisioning.create_address('108000', { :type => 'token', :channel => 'BBC' })
805
+ tropo_provisioning.create_address('108000', { :type => 'token', :channel => 'BBC' })
796
806
  rescue => e
797
807
  e.to_s.should == ":channel must be voice or messaging"
798
808
  end
@@ -800,157 +810,162 @@ describe "TropoProvisioning" do
800
810
 
801
811
  it "should add appropriate addresses" do
802
812
  # Add a address based on a prefix
803
- result = @tropo_provisioning.create_address('108000', { :type => 'number', :prefix => '1303' })
813
+ result = tropo_provisioning.create_address('108000', { :type => 'number', :prefix => '1303' })
804
814
  result[:href].should == "http://api.tropo.com/v1/applications/108000/addresses/number/7202551912"
805
815
  result[:address].should == '7202551912'
806
816
 
807
817
  # Add a jabber account
808
- result = @tropo_provisioning.create_address('108001', { :type => 'jabber', :username => 'xyz123@bot.im' })
818
+ result = tropo_provisioning.create_address('108001', { :type => 'jabber', :username => 'xyz123@bot.im' })
809
819
  result[:href].should == "http://api.tropo.com/v1/applications/108001/addresses/jabber/xyz123@bot.im"
810
820
  result[:address].should == 'xyz123@bot.im'
811
821
 
812
822
  # Add a token
813
- result = @tropo_provisioning.create_address('108002', { :type => 'token', :channel => 'voice' })
823
+ result = tropo_provisioning.create_address('108002', { :type => 'token', :channel => 'voice' })
814
824
  result[:href].should == "http://api.tropo.com/v1/applications/108002/addresses/token/12345679f90bac47a05b178c37d3c68aaf38d5bdbc5aba0c7abb12345d8a9fd13f1234c1234567dbe2c6f63b"
815
825
  result[:address].should == '12345679f90bac47a05b178c37d3c68aaf38d5bdbc5aba0c7abb12345d8a9fd13f1234c1234567dbe2c6f63b'
816
826
  end
817
827
 
818
828
  it "should delete a address" do
819
- result = @tropo_provisioning.delete_address('108000', '883510001812716')
829
+ result = tropo_provisioning.delete_address('108000', '883510001812716')
820
830
  result[:message].should == "delete successful"
821
831
  end
822
832
 
823
833
  it "should raise an ArgumentError if the right params are not passed to move_address" do
824
834
  begin
825
- @tropo_provisioning.move_address({ :to => '108002', :address => '883510001812716'})
835
+ tropo_provisioning.move_address({ :to => '108002', :address => '883510001812716'})
826
836
  rescue => e
827
837
  e.to_s.should == ':from is a required parameter'
828
838
  end
829
839
 
830
840
  begin
831
- @tropo_provisioning.move_address({ :from => '108002', :address => '883510001812716'})
841
+ tropo_provisioning.move_address({ :from => '108002', :address => '883510001812716'})
832
842
  rescue => e
833
843
  e.to_s.should == ':to is a required parameter'
834
844
  end
835
845
 
836
846
  begin
837
- @tropo_provisioning.move_address({ :from => '108002', :to => '883510001812716'})
847
+ tropo_provisioning.move_address({ :from => '108002', :to => '883510001812716'})
838
848
  rescue => e
839
849
  e.to_s.should == ':address is a required parameter'
840
850
  end
841
851
  end
842
852
 
843
853
  it "should move a address" do
844
- results = @tropo_provisioning.move_address({ :from => '108000', :to => '108002', :address => '883510001812716'})
854
+ results = tropo_provisioning.move_address({ :from => '108000', :to => '108002', :address => '883510001812716'})
845
855
  results.should == { 'message' => 'delete successful' }
846
856
  end
847
857
 
848
858
  it "should return accounts with associated addresses" do
849
859
  pending()
850
- result = @tropo_provisioning.account_with_addresses('108000')
860
+ result = tropo_provisioning.account_with_addresses('108000')
851
861
  result.should == nil
852
862
 
853
- result = @tropo_provisioning.accounts_with_addresses
863
+ result = tropo_provisioning.accounts_with_addresses
854
864
  result.should == nil
855
865
  end
856
866
  end
857
867
 
858
868
  describe 'exchanges' do
859
869
  it "should obtain a list of available exchanges" do
860
- results = @tropo_provisioning.exchanges
861
- results.should == ActiveSupport::JSON.decode(@exchanges)
870
+ results = tropo_provisioning.exchanges
871
+ results.should == ActiveSupport::JSON.decode(exchanges)
862
872
  end
863
873
  end
864
874
 
865
875
  describe 'user' do
866
876
  it "should raise argument errors on create_user if required params not passed" do
867
877
  begin
868
- @tropo_provisioning.create_user
878
+ tropo_provisioning.create_user
869
879
  rescue => e
870
880
  e.to_s.should == ':username is a required parameter'
871
881
  end
872
882
 
873
883
  begin
874
- @tropo_provisioning.create_user({ :username => "foobar7474" })
884
+ tropo_provisioning.create_user({ :username => "foobar7474" })
875
885
  rescue => e
876
886
  e.to_s.should == ':password is a required parameter'
877
887
  end
878
888
 
879
889
  begin
880
- @tropo_provisioning.create_user({ :username => "foobar7474", :password => 'fooey' })
890
+ tropo_provisioning.create_user({ :username => "foobar7474", :password => 'fooey' })
881
891
  rescue => e
882
892
  e.to_s.should == ':email is a required parameter'
883
893
  end
884
894
  end
885
895
 
886
896
  it "should create a new user" do
887
- result = @tropo_provisioning.create_user({ :username => "foobar7474", :password => 'fooey', :email => 'jsgoecke@voxeo.com' })
897
+ result = tropo_provisioning.create_user({ :username => "foobar7474", :password => 'fooey', :email => 'jsgoecke@voxeo.com' })
888
898
  result.should == @new_user
889
899
  end
890
900
 
891
901
  it "should confirm a user" do
892
- result = @tropo_provisioning.confirm_user('12345', '1234', '127.0.0.1')
902
+ result = tropo_provisioning.confirm_user('12345', '1234', '127.0.0.1')
893
903
  result.message.should == "successfully confirmed user 12345"
894
904
  end
895
905
 
896
906
  it "should obtain details about a user" do
897
- result = @tropo_provisioning.user('12345')
907
+ result = tropo_provisioning.user('12345')
898
908
  result.should == @existing_user
899
909
  end
900
910
 
901
911
  it 'should return a list of search terms that we search for' do
902
- result = @tropo_provisioning.search_users('username=foobar')
912
+ result = tropo_provisioning.search_users('username=foobar')
913
+ result.should == @search_accounts
914
+ end
915
+
916
+ it 'should return a list of search terms that we search for using a Hash parameter' do
917
+ result = tropo_provisioning.search_users({:username => "foobar"})
903
918
  result.should == @search_accounts
904
919
  end
905
920
 
906
921
  it 'should modify a user' do
907
- result = @tropo_provisioning.modify_user('12345', { :password => 'foobar' })
922
+ result = tropo_provisioning.modify_user('12345', { :password => 'foobar' })
908
923
  result.href.should == 'http://api-smsified-eng.voxeo.net/v1/users/12345'
909
- @tropo_provisioning.user_data['password'].should == 'foobar'
924
+ tropo_provisioning.user_data['password'].should == 'foobar'
910
925
  end
911
926
 
912
927
  it 'should see if a username is available' do
913
- @tropo_provisioning.username_exists?('12345').should == @username_check
928
+ tropo_provisioning.username_exists?('12345').should == @username_check
914
929
  end
915
930
  end
916
931
 
917
932
  describe 'features' do
918
933
  it "should return a list of available features" do
919
- result = @tropo_provisioning.features
934
+ result = tropo_provisioning.features
920
935
  result.should == @features
921
936
  end
922
937
 
923
938
  it "should return a list of features configured for a user" do
924
- result = @tropo_provisioning.user_features('12345')
939
+ result = tropo_provisioning.user_features('12345')
925
940
  result.should == @user_features
926
941
  end
927
942
 
928
943
  it "should add a feature to a user" do
929
- result = @tropo_provisioning.user_enable_feature('12345', 'http://api-smsified-eng.voxeo.net/v1/features/8')
944
+ result = tropo_provisioning.user_enable_feature('12345', 'http://api-smsified-eng.voxeo.net/v1/features/8')
930
945
  result.should == @feature
931
946
  end
932
947
 
933
948
  it "should disable a feature for a user" do
934
- result = @tropo_provisioning.user_disable_feature('12345', '8')
949
+ result = tropo_provisioning.user_disable_feature('12345', '8')
935
950
  result.should == @feature_delete_message
936
951
  end
937
952
  end
938
953
 
939
954
  describe 'platforms and partitions' do
940
955
  it 'should list the available partitions' do
941
- result = @tropo_provisioning.partitions
956
+ result = tropo_provisioning.partitions
942
957
  result[0]['name'].should == 'staging'
943
958
  end
944
959
 
945
960
  it 'should return a list of available platforms under a partition' do
946
- result = @tropo_provisioning.platforms('staging')
961
+ result = tropo_provisioning.platforms('staging')
947
962
  result[0].name.should == 'sms'
948
963
  end
949
964
  end
950
965
 
951
966
  describe 'payments' do
952
967
  it "should add a payment method to a user" do
953
- result = @tropo_provisioning.add_payment_info('12345', { :account_number => '1234567890',
968
+ result = tropo_provisioning.add_payment_info('12345', { :account_number => '1234567890',
954
969
  :payment_type => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
955
970
  :address => '123 Smith Avenue',
956
971
  :city => 'San Carlos',
@@ -968,7 +983,7 @@ describe "TropoProvisioning" do
968
983
  end
969
984
 
970
985
  it "should add a payment method to a user in camelCase" do
971
- result = @tropo_provisioning.add_payment_info('12345', { :accountNumber => '1234567890',
986
+ result = tropo_provisioning.add_payment_info('12345', { :accountNumber => '1234567890',
972
987
  :paymentType => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
973
988
  :address => '123 Smith Avenue',
974
989
  :city => 'San Carlos',
@@ -987,7 +1002,7 @@ describe "TropoProvisioning" do
987
1002
  end
988
1003
 
989
1004
  it 'should add a payment method to a user keys as strings' do
990
- result = @tropo_provisioning.add_payment_info('12345', { 'account_number' => '1234567890',
1005
+ result = tropo_provisioning.add_payment_info('12345', { 'account_number' => '1234567890',
991
1006
  'payment_type' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
992
1007
  'address' => '123 Smith Avenue',
993
1008
  'city' => 'San Carlos',
@@ -1007,7 +1022,7 @@ describe "TropoProvisioning" do
1007
1022
  end
1008
1023
 
1009
1024
  it 'should add a payment method to a user in camelCase and keys as strings' do
1010
- result = @tropo_provisioning.add_payment_info('12345', { 'accountNumber' => '1234567890',
1025
+ result = tropo_provisioning.add_payment_info('12345', { 'accountNumber' => '1234567890',
1011
1026
  'paymentType' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1012
1027
  'address' => '123 Smith Avenue',
1013
1028
  'city' => 'San Carlos',
@@ -1026,59 +1041,59 @@ describe "TropoProvisioning" do
1026
1041
  end
1027
1042
 
1028
1043
  it 'should return the balance' do
1029
- result = @tropo_provisioning.balance('12345')
1044
+ result = tropo_provisioning.balance('12345')
1030
1045
  result['balance'].should == "3.00"
1031
1046
  end
1032
1047
 
1033
1048
  it 'should make a payment' do
1034
- result = @tropo_provisioning.make_payment('1234', 1.0)
1049
+ result = tropo_provisioning.make_payment('1234', 1.0)
1035
1050
  result.message.should == "successfully posted payment for the amount 1.000000"
1036
1051
  end
1037
1052
 
1038
1053
  it "should get the payment method for a user" do
1039
- result = @tropo_provisioning.user_payment_method('12345')
1054
+ result = tropo_provisioning.user_payment_method('12345')
1040
1055
  result.should == @payment_method
1041
1056
  end
1042
1057
 
1043
1058
  it "should return a list of available payment types" do
1044
- result = @tropo_provisioning.available_payment_types
1059
+ result = tropo_provisioning.available_payment_types
1045
1060
  result.should == @payment_methods
1046
1061
  end
1047
1062
 
1048
1063
  it 'should raise an error if a float is not passed in amount for make_payment' do
1049
1064
  begin
1050
- @tropo_provisioning.make_payment('1234', { :foo => 'bar' })
1065
+ tropo_provisioning.make_payment('1234', { :foo => 'bar' })
1051
1066
  rescue => e
1052
1067
  e.to_s.should == "amount must be of type Float"
1053
1068
  end
1054
1069
  end
1055
1070
 
1056
1071
  it 'should update the recurring payment details' do
1057
- result = @tropo_provisioning.update_recurrence('1234', { :recharge_amount => 13.50, :threshold_percentage => 10 })
1072
+ result = tropo_provisioning.update_recurrence('1234', { :recharge_amount => 13.50, :threshold_percentage => 10 })
1058
1073
  result.should == @recurrence_updated
1059
1074
  end
1060
1075
 
1061
1076
  it 'should get the existing recurrent payment details' do
1062
- @tropo_provisioning.get_recurrence('1234').should == @recurrence
1077
+ tropo_provisioning.get_recurrence('1234').should == @recurrence
1063
1078
  end
1064
1079
  end
1065
1080
 
1066
1081
  describe 'whitelists' do
1067
1082
  it 'should get the whitelist for a user account' do
1068
- result = @tropo_provisioning.whitelist('12345')
1083
+ result = tropo_provisioning.whitelist('12345')
1069
1084
  result.should == @whitelist
1070
1085
 
1071
- result = @tropo_provisioning.whitelist
1086
+ result = tropo_provisioning.whitelist
1072
1087
  result.should == @whitelist
1073
1088
  end
1074
1089
 
1075
1090
  it 'should add to a whitelist' do
1076
- result = @tropo_provisioning.add_whitelist({ :user_id => '12345', :value => '14155551212' })
1091
+ result = tropo_provisioning.add_whitelist({ :user_id => '12345', :value => '14155551212' })
1077
1092
  result.should == @whitelist
1078
1093
  end
1079
1094
 
1080
1095
  it 'should remove from a whitelist' do
1081
- result = @tropo_provisioning.delete_whitelist({ :user_id => '12345', :value => '14155551212' })
1096
+ result = tropo_provisioning.delete_whitelist({ :user_id => '12345', :value => '14155551212' })
1082
1097
  result.should == @whitelist
1083
1098
  end
1084
1099
  end
@@ -1086,7 +1101,7 @@ describe "TropoProvisioning" do
1086
1101
  describe 'custome error' do
1087
1102
  it 'should raise a custom error with an http_status code on the error object' do
1088
1103
  begin
1089
- @tropo_provisioning.user('98765')
1104
+ tropo_provisioning.user('98765')
1090
1105
  rescue => e
1091
1106
  e.http_status.should == "404"
1092
1107
  e.message.should == '404: Got an error here! - '
@@ -1096,73 +1111,72 @@ describe "TropoProvisioning" do
1096
1111
 
1097
1112
  describe 'geography' do
1098
1113
  it 'should return a list of countries' do
1099
- @tropo_provisioning.countries.should == @countries
1114
+ tropo_provisioning.countries.should == @countries
1100
1115
  end
1101
1116
 
1102
1117
  it 'should have the id added for the country' do
1103
- result = @tropo_provisioning.countries[1][:id].should == '36'
1118
+ result = tropo_provisioning.countries[1][:id].should == '36'
1104
1119
  end
1105
1120
 
1106
1121
  it 'should return a list of states' do
1107
- @tropo_provisioning.states('36').should == @states
1122
+ tropo_provisioning.states('36').should == @states
1108
1123
  end
1109
1124
 
1110
1125
  it 'should have the id added for the state' do
1111
- @tropo_provisioning.states('36')[1]['id'].should == '50'
1126
+ tropo_provisioning.states('36')[1]['id'].should == '50'
1112
1127
  end
1113
1128
  end
1114
1129
 
1115
1130
  describe 'invitations' do
1116
1131
  it 'should return a list of inivitations' do
1117
- @tropo_provisioning.invitations.should == @invitations
1132
+ tropo_provisioning.invitations.should == @invitations
1118
1133
  end
1119
1134
 
1120
1135
  it 'should return an invitation' do
1121
- @tropo_provisioning.invitation('ABC457').should == @invitations[1]
1136
+ tropo_provisioning.invitation('ABC457').should == @invitations[1]
1122
1137
  end
1123
1138
 
1124
1139
  it 'should create an invitation' do
1125
- @tropo_provisioning.create_invitation({ :code => 'ABC457',
1140
+ tropo_provisioning.create_invitation({ :code => 'ABC457',
1126
1141
  :count => 100,
1127
1142
  :credit => 10 }).should == @invitation_created
1128
1143
  end
1129
1144
 
1130
1145
  it 'should create an invitationfor a specific user' do
1131
- @tropo_provisioning.create_invitation('15909',
1146
+ tropo_provisioning.create_invitation('15909',
1132
1147
  { :code => 'ABC457',
1133
1148
  :count => 100,
1134
1149
  :credit => 10 }).should == @invitation_created
1135
1150
  end
1136
1151
 
1137
1152
  it 'should update an invitation' do
1138
- @tropo_provisioning.update_invitation('ABC457', :count => 200).should == @invitation_created
1153
+ tropo_provisioning.update_invitation('ABC457', :count => 200).should == @invitation_created
1139
1154
  end
1140
1155
 
1141
1156
  it 'should update an invitation for a specific user' do
1142
- @tropo_provisioning.update_invitation('ABC457', '15909', :count => 200).should == @invitation_created
1157
+ tropo_provisioning.update_invitation('ABC457', '15909', :count => 200).should == @invitation_created
1143
1158
  end
1144
1159
 
1145
1160
  it 'should delete an invitation' do
1146
- @tropo_provisioning.delete_invitation('ABC457').should == @deleted_invitation
1161
+ tropo_provisioning.delete_invitation('ABC457').should == @deleted_invitation
1147
1162
  end
1148
1163
 
1149
1164
  it 'should delete a specific user invitation' do
1150
- @tropo_provisioning.delete_invitation('ABC457', '15909').should == @deleted_invitation
1165
+ tropo_provisioning.delete_invitation('ABC457', '15909').should == @deleted_invitation
1151
1166
  end
1152
1167
 
1153
1168
  it 'should fetch the invitations for a user' do
1154
- @tropo_provisioning.user_invitations('15909').should == [@invitation_created]
1169
+ tropo_provisioning.user_invitations('15909').should == [@invitation_created]
1155
1170
  end
1156
1171
 
1157
1172
  it 'should list a specific invitation for a user' do
1158
- @tropo_provisioning.invitation('ABC457', '15909').should == @invitations[1]
1173
+ tropo_provisioning.invitation('ABC457', '15909').should == @invitations[1]
1159
1174
  end
1160
1175
  end
1161
1176
 
1162
1177
  describe "HTTPS/SSL support" do
1163
1178
  it 'should fetch invitations via HTTPS/SSL' do
1164
- tp = TropoProvisioning.new('foo', 'bar', :base_uri => 'https://foo:bar@api.tropo.com/v1')
1165
- tp.invitations.should == @invitations
1179
+ tropo_provisioning.invitations.should == @invitations
1166
1180
  end
1167
1181
  end
1168
1182
  end