tropo-provisioning 0.0.24 → 0.0.25

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tropo-provisioning (0.0.24)
4
+ tropo-provisioning (0.0.25)
5
5
  activesupport
6
6
  hashie (>= 0.2.1)
7
7
  i18n
@@ -9,15 +9,15 @@ PATH
9
9
  GEM
10
10
  remote: http://rubygems.org/
11
11
  specs:
12
- activesupport (3.2.3)
12
+ activesupport (3.2.9)
13
13
  i18n (~> 0.6)
14
14
  multi_json (~> 1.0)
15
15
  diff-lcs (1.1.3)
16
16
  fakeweb (1.3.0)
17
17
  hashie (1.2.0)
18
- i18n (0.6.0)
18
+ i18n (0.6.1)
19
19
  json (1.7.3)
20
- multi_json (1.3.5)
20
+ multi_json (1.5.0)
21
21
  rake (0.9.2.2)
22
22
  rdoc (3.12)
23
23
  json (~> 1.4)
data/changelog.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## 0.0.25
4
+ * Optional SSL validation `TropoProvisioning.new('foo', 'bar', {:verify_certificate => false })`
@@ -17,6 +17,8 @@ class TropoClient
17
17
  attr_reader :username
18
18
  # password associated to :username
19
19
  attr_reader :password
20
+ # whether to require a valid certificate if using SSL
21
+ attr_reader :verify_certificate
20
22
 
21
23
  ##
22
24
  # Creates a new TropoClient instance
@@ -27,10 +29,11 @@ class TropoClient
27
29
  # * [optional, String] *base_uri* Tropo provisioning API endpoint
28
30
  # * [optional, String] *headers* required HTTP headers
29
31
  # * [optional, Hash] * proxy => {"host" : <host>, "port" : <port>}
32
+ # * [optional, Boolean] :verify_certificate whether to require a valid certificate if using SSL, defaults to true
30
33
  #
31
34
  # ==== Return
32
35
  # * new TropoClient instance
33
- def initialize(username, password, base_uri = "https://api.tropo.com/v1/", headers = nil, proxy = nil)
36
+ def initialize(username, password, base_uri = "https://api.tropo.com/v1/", headers = nil, proxy = nil, verify_certificate = true)
34
37
  @base_uri = base_uri
35
38
  if RUBY_VERSION =~ /1.8/
36
39
  @base_uri << "/" if !@base_uri[-1].eql?(47)
@@ -42,6 +45,7 @@ class TropoClient
42
45
  @password = password
43
46
  @headers = headers.nil? ? {} : headers
44
47
  @proxy = proxy
48
+ @verify_certificate = verify_certificate
45
49
  end
46
50
 
47
51
  ##
@@ -165,7 +169,10 @@ class TropoClient
165
169
  end
166
170
 
167
171
  http = base.new(uri.host, uri.port)
168
- http.use_ssl = true if uri.scheme == 'https'
172
+ if uri.scheme == 'https'
173
+ http.use_ssl = true
174
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @verify_certificate
175
+ end
169
176
  http
170
177
  )
171
178
  end
@@ -17,7 +17,7 @@ class TropoProvisioning
17
17
  # Array of supported partitions in Tropo
18
18
  VALID_PARTITIONS = %w(staging production)
19
19
 
20
- attr_reader :user_data, :base_uri
20
+ attr_reader :user_data, :base_uri, :verify_certificate
21
21
 
22
22
  ##
23
23
  # Creates a new TropoProvisioning object
@@ -27,14 +27,16 @@ class TropoProvisioning
27
27
  # * [required, String] password for your Tropo user
28
28
  # * [optional, Hash] params
29
29
  # * [optional, String] :base_uri to use for accessing the provisioning API if you would like a custom one
30
+ # * [optional, Boolean] :verify_certificate whether to require a valid certificate if using SSL, defaults to true
30
31
  #
31
32
  # ==== Return
32
33
  #
33
34
  # TropoProvisioning object
34
35
  def initialize(username, password, params={})
35
- @base_uri = (params[:base_uri] || "https://api.tropo.com/v1/").sub(/(\/)+$/,'/')
36
- proxy = params[:proxy] || nil
37
- @tropo_client = TropoClient.new(username, password, @base_uri, { 'Content-Type' => 'application/json' }, proxy)
36
+ @base_uri = (params[:base_uri] || "https://api.tropo.com/v1/").sub(/(\/)+$/,'/')
37
+ proxy = params[:proxy] || nil
38
+ @verify_certificate = params[:verify_certificate] || true
39
+ @tropo_client = TropoClient.new(username, password, @base_uri, { 'Content-Type' => 'application/json' }, proxy, @verify_certificate)
38
40
  user(username)
39
41
  end
40
42
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  class TropoProvisioning
3
3
  # Current gem version
4
- VERSION = "0.0.24"
4
+ VERSION = "0.0.25"
5
5
  end
@@ -6,26 +6,26 @@ FakeWeb.allow_net_connect = false
6
6
  describe "TropoProvisioning" do
7
7
  let(:applications) do
8
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" } ]
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
29
  end
30
30
 
31
31
  before(:all) do
@@ -167,10 +167,10 @@ describe "TropoProvisioning" do
167
167
 
168
168
  # Alternate Base URI
169
169
  FakeWeb.register_uri(:get,
170
- "http://foo:bar@testserver.com/rest/v1/users/foo",
171
- :body => '{}',
172
- :content_type => "application/json",
173
- :status => ["200", "OK"])
170
+ "http://foo:bar@testserver.com/rest/v1/users/foo",
171
+ :body => '{}',
172
+ :content_type => "application/json",
173
+ :status => ["200", "OK"])
174
174
 
175
175
 
176
176
  # A specific application
@@ -245,11 +245,11 @@ describe "TropoProvisioning" do
245
245
  :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/108001/addresses/jabber/xyz123@bot.im" }),
246
246
  :content_type => "application/json")
247
247
 
248
- # Create a address that is a Token
249
- FakeWeb.register_uri(:post,
250
- "https://foo:bar@api.tropo.com/v1/applications/108002/addresses",
251
- :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/108002/addresses/token/12345679f90bac47a05b178c37d3c68aaf38d5bdbc5aba0c7abb12345d8a9fd13f1234c1234567dbe2c6f63b" }),
252
- :content_type => "application/json")
248
+ # Create a address that is a Token
249
+ FakeWeb.register_uri(:post,
250
+ "https://foo:bar@api.tropo.com/v1/applications/108002/addresses",
251
+ :body => ActiveSupport::JSON.encode({ "href" => "http://api.tropo.com/v1/applications/108002/addresses/token/12345679f90bac47a05b178c37d3c68aaf38d5bdbc5aba0c7abb12345d8a9fd13f1234c1234567dbe2c6f63b" }),
252
+ :content_type => "application/json")
253
253
 
254
254
  # Delete an application
255
255
  FakeWeb.register_uri(:delete,
@@ -279,138 +279,138 @@ describe "TropoProvisioning" do
279
279
  :content_type => "application/json",
280
280
  :status => ["200", "OK"])
281
281
 
282
- # Create a new user
283
- FakeWeb.register_uri(:post,
284
- "https://foo:bar@api.tropo.com/v1/users",
285
- :body => @new_user_json,
286
- :content_type => "application/json",
287
- :status => ["200", "OK"])
288
-
289
- # Get a specific user by user_id
290
- FakeWeb.register_uri(:get,
291
- "https://foo:bar@api.tropo.com/v1/users/12345",
292
- :body => ActiveSupport::JSON.encode(@existing_user),
293
- :content_type => "application/json",
294
- :status => ["200", "OK"])
295
-
296
- # Get a specific user by user_id
297
- FakeWeb.register_uri(:get,
298
- "https://foo:bar@api.tropo.com/v1/users/98765",
299
- :body => nil,
300
- :content_type => "application/json",
301
- :status => ["404", "Got an error here!"])
302
-
303
- # Get a specific user by username
304
- FakeWeb.register_uri(:get,
305
- "https://foo:bar@api.tropo.com/v1/users/foo",
306
- :body => ActiveSupport::JSON.encode(@existing_user),
307
- :content_type => "application/json",
308
- :status => ["200", "OK"])
309
-
310
- # Get a specific user by username with HTTPS/SSL
311
- FakeWeb.register_uri(:get,
312
- "https://foo:bar@api.tropo.com/v1/users/foo",
313
- :body => ActiveSupport::JSON.encode(@existing_user),
314
- :content_type => "application/json",
315
- :status => ["200", "OK"])
316
-
317
- # Invalid credentials
318
- FakeWeb.register_uri(:get,
319
- "https://bad:password@api.tropo.com/v1/users/bad",
320
- :content_type => "application/json",
321
- :status => ["401", "Unauthorized"])
322
-
323
- # Confirm an account account
324
- FakeWeb.register_uri(:post,
325
- "https://foo:bar@api.tropo.com/v1/users/12345/confirmations",
326
- :body => ActiveSupport::JSON.encode({"message" => "successfully confirmed user 12345" }),
327
- :content_type => "application/json",
328
- :status => ["200", "OK"])
329
-
330
- # Return the payment method configured for a user
331
- FakeWeb.register_uri(:get,
332
- "https://foo:bar@api.tropo.com/v1/users/12345/payment/method",
333
- :body => ActiveSupport::JSON.encode(@payment_method),
334
- :content_type => "application/json",
335
- :status => ["200", "OK"])
336
-
337
- # Return payment types
338
- FakeWeb.register_uri(:get,
339
- "https://foo:bar@api.tropo.com/v1/types/payment",
340
- :body => ActiveSupport::JSON.encode(@payment_methods),
341
- :content_type => "application/json",
342
- :status => ["200", "OK"])
343
-
344
- # Return features
345
- FakeWeb.register_uri(:get,
346
- "https://foo:bar@api.tropo.com/v1/features",
347
- :body => ActiveSupport::JSON.encode(@features),
348
- :content_type => "application/json",
349
- :status => ["200", "OK"])
350
-
351
- # Return features for a user
352
- FakeWeb.register_uri(:get,
353
- "https://foo:bar@api.tropo.com/v1/users/12345/features",
354
- :body => ActiveSupport::JSON.encode(@user_features),
355
- :content_type => "application/json",
356
- :status => ["200", "OK"])
357
-
358
- # Add a feature to a user
359
- FakeWeb.register_uri(:post,
360
- "https://foo:bar@api.tropo.com/v1/users/12345/features",
361
- :body => ActiveSupport::JSON.encode(@feature),
362
- :content_type => "application/json",
363
- :status => ["200", "OK"])
364
-
365
- # Add a feature to a user
366
- FakeWeb.register_uri(:delete,
367
- "https://foo:bar@api.tropo.com/v1/users/12345/features/8",
368
- :body => ActiveSupport::JSON.encode(@feature_delete_message),
369
- :content_type => "application/json",
370
- :status => ["200", "OK"])
371
-
372
- # Add payment info to a user
373
- FakeWeb.register_uri(:put,
374
- "https://foo:bar@api.tropo.com/v1/users/12345/payment/method",
375
- :body => ActiveSupport::JSON.encode(@payment_info_message),
376
- :content_type => "application/json",
377
- :status => ["200", "OK"])
378
-
379
-
380
- # List an account, with bad credentials
381
- FakeWeb.register_uri(:get,
382
- "https://evolution.voxeo.com/api/account/accesstoken/get.jsp?username=foobar7474&password=fooeyfooey",
383
- :body => ActiveSupport::JSON.encode(@bad_account_creds),
384
- :content_type => "application/json",
385
- :status => ["403", "Invalid Login."])
386
-
387
- # Get our search terms
388
- FakeWeb.register_uri(:get,
389
- "https://foo:bar@api.tropo.com/v1/users/?username=foobar",
390
- :body => ActiveSupport::JSON.encode(@search_accounts),
391
- :content_type => "application/json",
392
- :status => ["200", "OK"])
393
-
394
- # Payment resource
395
- FakeWeb.register_uri(:post,
396
- "https://foo:bar@api.tropo.com/v1/users/1234/payments",
397
- :body => ActiveSupport::JSON.encode({ :message => "successfully posted payment for the amount 1.000000" }),
398
- :content_type => "application/json",
399
- :status => ["200", "OK"])
400
-
401
- # Modify a user
402
- FakeWeb.register_uri(:put,
403
- "https://foo:bar@api.tropo.com/v1/users/12345",
404
- :body => ActiveSupport::JSON.encode({ :href => "http://api-smsified-eng.voxeo.net/v1/users/12345" }),
405
- :content_type => "application/json",
406
- :status => ["200", "OK"])
407
-
408
- # List available partitions
409
- FakeWeb.register_uri(:get,
410
- "https://foo:bar@api.tropo.com/v1/partitions",
411
- :body => ActiveSupport::JSON.encode(@partitions),
412
- :content_type => "application/json",
413
- :status => ["200", "OK"])
282
+ # Create a new user
283
+ FakeWeb.register_uri(:post,
284
+ "https://foo:bar@api.tropo.com/v1/users",
285
+ :body => @new_user_json,
286
+ :content_type => "application/json",
287
+ :status => ["200", "OK"])
288
+
289
+ # Get a specific user by user_id
290
+ FakeWeb.register_uri(:get,
291
+ "https://foo:bar@api.tropo.com/v1/users/12345",
292
+ :body => ActiveSupport::JSON.encode(@existing_user),
293
+ :content_type => "application/json",
294
+ :status => ["200", "OK"])
295
+
296
+ # Get a specific user by user_id
297
+ FakeWeb.register_uri(:get,
298
+ "https://foo:bar@api.tropo.com/v1/users/98765",
299
+ :body => nil,
300
+ :content_type => "application/json",
301
+ :status => ["404", "Got an error here!"])
302
+
303
+ # Get a specific user by username
304
+ FakeWeb.register_uri(:get,
305
+ "https://foo:bar@api.tropo.com/v1/users/foo",
306
+ :body => ActiveSupport::JSON.encode(@existing_user),
307
+ :content_type => "application/json",
308
+ :status => ["200", "OK"])
309
+
310
+ # Get a specific user by username with HTTPS/SSL
311
+ FakeWeb.register_uri(:get,
312
+ "https://foo:bar@api.tropo.com/v1/users/foo",
313
+ :body => ActiveSupport::JSON.encode(@existing_user),
314
+ :content_type => "application/json",
315
+ :status => ["200", "OK"])
316
+
317
+ # Invalid credentials
318
+ FakeWeb.register_uri(:get,
319
+ "https://bad:password@api.tropo.com/v1/users/bad",
320
+ :content_type => "application/json",
321
+ :status => ["401", "Unauthorized"])
322
+
323
+ # Confirm an account account
324
+ FakeWeb.register_uri(:post,
325
+ "https://foo:bar@api.tropo.com/v1/users/12345/confirmations",
326
+ :body => ActiveSupport::JSON.encode({"message" => "successfully confirmed user 12345" }),
327
+ :content_type => "application/json",
328
+ :status => ["200", "OK"])
329
+
330
+ # Return the payment method configured for a user
331
+ FakeWeb.register_uri(:get,
332
+ "https://foo:bar@api.tropo.com/v1/users/12345/payment/method",
333
+ :body => ActiveSupport::JSON.encode(@payment_method),
334
+ :content_type => "application/json",
335
+ :status => ["200", "OK"])
336
+
337
+ # Return payment types
338
+ FakeWeb.register_uri(:get,
339
+ "https://foo:bar@api.tropo.com/v1/types/payment",
340
+ :body => ActiveSupport::JSON.encode(@payment_methods),
341
+ :content_type => "application/json",
342
+ :status => ["200", "OK"])
343
+
344
+ # Return features
345
+ FakeWeb.register_uri(:get,
346
+ "https://foo:bar@api.tropo.com/v1/features",
347
+ :body => ActiveSupport::JSON.encode(@features),
348
+ :content_type => "application/json",
349
+ :status => ["200", "OK"])
350
+
351
+ # Return features for a user
352
+ FakeWeb.register_uri(:get,
353
+ "https://foo:bar@api.tropo.com/v1/users/12345/features",
354
+ :body => ActiveSupport::JSON.encode(@user_features),
355
+ :content_type => "application/json",
356
+ :status => ["200", "OK"])
357
+
358
+ # Add a feature to a user
359
+ FakeWeb.register_uri(:post,
360
+ "https://foo:bar@api.tropo.com/v1/users/12345/features",
361
+ :body => ActiveSupport::JSON.encode(@feature),
362
+ :content_type => "application/json",
363
+ :status => ["200", "OK"])
364
+
365
+ # Add a feature to a user
366
+ FakeWeb.register_uri(:delete,
367
+ "https://foo:bar@api.tropo.com/v1/users/12345/features/8",
368
+ :body => ActiveSupport::JSON.encode(@feature_delete_message),
369
+ :content_type => "application/json",
370
+ :status => ["200", "OK"])
371
+
372
+ # Add payment info to a user
373
+ FakeWeb.register_uri(:put,
374
+ "https://foo:bar@api.tropo.com/v1/users/12345/payment/method",
375
+ :body => ActiveSupport::JSON.encode(@payment_info_message),
376
+ :content_type => "application/json",
377
+ :status => ["200", "OK"])
378
+
379
+
380
+ # List an account, with bad credentials
381
+ FakeWeb.register_uri(:get,
382
+ "https://evolution.voxeo.com/api/account/accesstoken/get.jsp?username=foobar7474&password=fooeyfooey",
383
+ :body => ActiveSupport::JSON.encode(@bad_account_creds),
384
+ :content_type => "application/json",
385
+ :status => ["403", "Invalid Login."])
386
+
387
+ # Get our search terms
388
+ FakeWeb.register_uri(:get,
389
+ "https://foo:bar@api.tropo.com/v1/users/?username=foobar",
390
+ :body => ActiveSupport::JSON.encode(@search_accounts),
391
+ :content_type => "application/json",
392
+ :status => ["200", "OK"])
393
+
394
+ # Payment resource
395
+ FakeWeb.register_uri(:post,
396
+ "https://foo:bar@api.tropo.com/v1/users/1234/payments",
397
+ :body => ActiveSupport::JSON.encode({ :message => "successfully posted payment for the amount 1.000000" }),
398
+ :content_type => "application/json",
399
+ :status => ["200", "OK"])
400
+
401
+ # Modify a user
402
+ FakeWeb.register_uri(:put,
403
+ "https://foo:bar@api.tropo.com/v1/users/12345",
404
+ :body => ActiveSupport::JSON.encode({ :href => "http://api-smsified-eng.voxeo.net/v1/users/12345" }),
405
+ :content_type => "application/json",
406
+ :status => ["200", "OK"])
407
+
408
+ # List available partitions
409
+ FakeWeb.register_uri(:get,
410
+ "https://foo:bar@api.tropo.com/v1/partitions",
411
+ :body => ActiveSupport::JSON.encode(@partitions),
412
+ :content_type => "application/json",
413
+ :status => ["200", "OK"])
414
414
 
415
415
  # List available platforms
416
416
  FakeWeb.register_uri(:get,
@@ -426,18 +426,18 @@ describe "TropoProvisioning" do
426
426
  :content_type => "application/json",
427
427
  :status => ["200", "OK"])
428
428
 
429
- # Whitelist
430
- FakeWeb.register_uri(:get,
431
- "https://foo:bar@api.tropo.com/v1/users/12345/partitions/production/platforms/sms/whitelist",
432
- :body => ActiveSupport::JSON.encode(@whitelist),
433
- :content_type => "application/json",
434
- :status => ["200", "OK"])
435
429
  # Whitelist
436
- FakeWeb.register_uri(:get,
437
- "https://foo:bar@api.tropo.com/v1/users/partitions/production/platforms/sms/whitelist",
438
- :body => ActiveSupport::JSON.encode(@whitelist),
439
- :content_type => "application/json",
440
- :status => ["200", "OK"])
430
+ FakeWeb.register_uri(:get,
431
+ "https://foo:bar@api.tropo.com/v1/users/12345/partitions/production/platforms/sms/whitelist",
432
+ :body => ActiveSupport::JSON.encode(@whitelist),
433
+ :content_type => "application/json",
434
+ :status => ["200", "OK"])
435
+ # Whitelist
436
+ FakeWeb.register_uri(:get,
437
+ "https://foo:bar@api.tropo.com/v1/users/partitions/production/platforms/sms/whitelist",
438
+ :body => ActiveSupport::JSON.encode(@whitelist),
439
+ :content_type => "application/json",
440
+ :status => ["200", "OK"])
441
441
 
442
442
  # Whitelist create
443
443
  FakeWeb.register_uri(:post,
@@ -632,6 +632,18 @@ describe "TropoProvisioning" do
632
632
  tropo_provisioning.instance_of?(TropoProvisioning).should == true
633
633
  end
634
634
 
635
+ it "should validate SSL by default" do
636
+ tropo_provisioning.verify_certificate.should == true
637
+ end
638
+
639
+
640
+ it "should not validate SSL when told to" do
641
+ tp = TropoProvisioning.new('foo', 'bar', {:verify_certificate => false })
642
+ tp.verify_certificate.should == true
643
+ end
644
+
645
+
646
+
635
647
  describe 'authentication' do
636
648
  it "should get an unathorized back if there is an invalid username or password" do
637
649
  begin
@@ -696,18 +708,18 @@ describe "TropoProvisioning" do
696
708
  it "should raise ArgumentErrors if appropriate values are not passed" do
697
709
  begin
698
710
  tropo_provisioning.create_application({ :name => 'foobar',
699
- :partition => 'foobar',
700
- :platform => 'foobar',
701
- :messagingUrl => 'http://foobar' })
711
+ :partition => 'foobar',
712
+ :platform => 'foobar',
713
+ :messagingUrl => 'http://foobar' })
702
714
  rescue => e
703
715
  e.to_s.should == ":platform must be 'scripting' or 'webapi'"
704
716
  end
705
717
 
706
718
  begin
707
719
  tropo_provisioning.create_application({ :name => 'foobar',
708
- :partition => 'foobar',
709
- :platform => 'scripting',
710
- :messagingUrl => 'http://foobar' })
720
+ :partition => 'foobar',
721
+ :platform => 'scripting',
722
+ :messagingUrl => 'http://foobar' })
711
723
  rescue => e
712
724
  e.to_s.should == ":partition must be 'staging' or 'production'"
713
725
  end
@@ -716,17 +728,17 @@ describe "TropoProvisioning" do
716
728
  it "should receive an href back when we create a new application receiving an href back" do
717
729
  # With camelCase
718
730
  result = tropo_provisioning.create_application({ :name => 'foobar',
719
- :partition => 'production',
720
- :platform => 'scripting',
721
- :messagingUrl => 'http://foobar' })
731
+ :partition => 'production',
732
+ :platform => 'scripting',
733
+ :messagingUrl => 'http://foobar' })
722
734
  result.href.should == "http://api.tropo.com/v1/applications/108016"
723
735
  result.application_id.should == '108016'
724
736
 
725
737
  # With underscores
726
738
  result = tropo_provisioning.create_application({ :name => 'foobar',
727
- :partition => 'production',
728
- :platform => 'scripting',
729
- :messaging_url => 'http://foobar' })
739
+ :partition => 'production',
740
+ :platform => 'scripting',
741
+ :messaging_url => 'http://foobar' })
730
742
  result.href.should == "http://api.tropo.com/v1/applications/108016"
731
743
  result.application_id.should == '108016'
732
744
  end
@@ -734,16 +746,16 @@ describe "TropoProvisioning" do
734
746
  it "should receive an href back when we update an application receiving an href back" do
735
747
  # With camelCase
736
748
  result = tropo_provisioning.update_application('108000', { :name => 'foobar',
737
- :partition => 'production',
738
- :platform => 'scripting',
739
- :messagingUrl => 'http://foobar' })
749
+ :partition => 'production',
750
+ :platform => 'scripting',
751
+ :messagingUrl => 'http://foobar' })
740
752
  result.href.should == "http://api.tropo.com/v1/applications/108016"
741
753
 
742
754
  # With underscore
743
755
  result = tropo_provisioning.update_application('108000', { :name => 'foobar',
744
- :partition => 'production',
745
- :platform => 'scripting',
746
- :messaging_url => 'http://foobar' })
756
+ :partition => 'production',
757
+ :platform => 'scripting',
758
+ :messaging_url => 'http://foobar' })
747
759
  result.href.should == "http://api.tropo.com/v1/applications/108016"
748
760
  end
749
761
 
@@ -988,56 +1000,56 @@ describe "TropoProvisioning" do
988
1000
  describe 'payments' do
989
1001
  it "should add a payment method to a user" do
990
1002
  result = tropo_provisioning.add_payment_info('12345', { :account_number => '1234567890',
991
- :payment_type => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
992
- :address => '123 Smith Avenue',
993
- :city => 'San Carlos',
994
- :state => 'CA',
995
- :postal_code => '94070',
996
- :country => 'USA',
997
- :name_on_account => 'Tropo User',
998
- :expiration_date => '2011-12-10',
999
- :security_code => '123',
1000
- :recharge_amount => 10.50,
1001
- :recharge_threshold => 5.00,
1002
- :email => 'j@doe.com',
1003
- :phone_number => '4155551212' })
1003
+ :payment_type => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1004
+ :address => '123 Smith Avenue',
1005
+ :city => 'San Carlos',
1006
+ :state => 'CA',
1007
+ :postal_code => '94070',
1008
+ :country => 'USA',
1009
+ :name_on_account => 'Tropo User',
1010
+ :expiration_date => '2011-12-10',
1011
+ :security_code => '123',
1012
+ :recharge_amount => 10.50,
1013
+ :recharge_threshold => 5.00,
1014
+ :email => 'j@doe.com',
1015
+ :phone_number => '4155551212' })
1004
1016
  result.should == @payment_info_message
1005
1017
  end
1006
1018
 
1007
1019
  it "should add a payment method to a user in camelCase" do
1008
1020
  result = tropo_provisioning.add_payment_info('12345', { :accountNumber => '1234567890',
1009
- :paymentType => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1010
- :address => '123 Smith Avenue',
1011
- :city => 'San Carlos',
1012
- :state => 'CA',
1013
- :postalCode => '94070',
1014
- :country => 'USA',
1015
- :nameOnAccount => 'Tropo User',
1016
- :expirationDate => '2011-12-10',
1017
- :securityCode => '123',
1018
- :rechargeAmount => 10.50,
1019
- :rechargeThreshold => 5.00,
1020
- :email => 'j@doe.com',
1021
- :phoneNumber => '4155551212' })
1021
+ :paymentType => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1022
+ :address => '123 Smith Avenue',
1023
+ :city => 'San Carlos',
1024
+ :state => 'CA',
1025
+ :postalCode => '94070',
1026
+ :country => 'USA',
1027
+ :nameOnAccount => 'Tropo User',
1028
+ :expirationDate => '2011-12-10',
1029
+ :securityCode => '123',
1030
+ :rechargeAmount => 10.50,
1031
+ :rechargeThreshold => 5.00,
1032
+ :email => 'j@doe.com',
1033
+ :phoneNumber => '4155551212' })
1022
1034
 
1023
1035
  result.should == @payment_info_message
1024
1036
  end
1025
1037
 
1026
1038
  it 'should add a payment method to a user keys as strings' do
1027
1039
  result = tropo_provisioning.add_payment_info('12345', { 'account_number' => '1234567890',
1028
- 'payment_type' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1029
- 'address' => '123 Smith Avenue',
1030
- 'city' => 'San Carlos',
1031
- 'state' => 'CA',
1032
- 'postal_code' => '94070',
1033
- 'country' => 'USA',
1034
- 'name_on_account' => 'Tropo User',
1035
- 'expiration_date' => '2011-12-10',
1036
- 'security_code' => '123',
1037
- 'recharge_amount' => 10.50,
1038
- 'recharge_threshold' => 5.00,
1039
- 'email' => 'j@doe.com',
1040
- 'phone_number' => '4155551212' })
1040
+ 'payment_type' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1041
+ 'address' => '123 Smith Avenue',
1042
+ 'city' => 'San Carlos',
1043
+ 'state' => 'CA',
1044
+ 'postal_code' => '94070',
1045
+ 'country' => 'USA',
1046
+ 'name_on_account' => 'Tropo User',
1047
+ 'expiration_date' => '2011-12-10',
1048
+ 'security_code' => '123',
1049
+ 'recharge_amount' => 10.50,
1050
+ 'recharge_threshold' => 5.00,
1051
+ 'email' => 'j@doe.com',
1052
+ 'phone_number' => '4155551212' })
1041
1053
 
1042
1054
 
1043
1055
  result.should == @payment_info_message
@@ -1045,19 +1057,19 @@ describe "TropoProvisioning" do
1045
1057
 
1046
1058
  it 'should add a payment method to a user in camelCase and keys as strings' do
1047
1059
  result = tropo_provisioning.add_payment_info('12345', { 'accountNumber' => '1234567890',
1048
- 'paymentType' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1049
- 'address' => '123 Smith Avenue',
1050
- 'city' => 'San Carlos',
1051
- 'state' => 'CA',
1052
- 'postalCode' => '94070',
1053
- 'country' => 'USA',
1054
- 'nameOnAccount' => 'Tropo User',
1055
- 'expirationDate' => '2011-12-10',
1056
- 'securityCode' => '123',
1057
- 'rechargeAmount' => 10.50,
1058
- 'rechargeThreshold' => 5.00,
1059
- 'email' => 'j@doe.com',
1060
- 'phone_number' => '4155551212' })
1060
+ 'paymentType' => 'https://api-smsified-eng.voxeo.net/v1/types/payment/1',
1061
+ 'address' => '123 Smith Avenue',
1062
+ 'city' => 'San Carlos',
1063
+ 'state' => 'CA',
1064
+ 'postalCode' => '94070',
1065
+ 'country' => 'USA',
1066
+ 'nameOnAccount' => 'Tropo User',
1067
+ 'expirationDate' => '2011-12-10',
1068
+ 'securityCode' => '123',
1069
+ 'rechargeAmount' => 10.50,
1070
+ 'rechargeThreshold' => 5.00,
1071
+ 'email' => 'j@doe.com',
1072
+ 'phone_number' => '4155551212' })
1061
1073
 
1062
1074
  result.should == @payment_info_message
1063
1075
  end
@@ -1160,15 +1172,15 @@ describe "TropoProvisioning" do
1160
1172
 
1161
1173
  it 'should create an invitation' do
1162
1174
  tropo_provisioning.create_invitation({ :code => 'ABC457',
1163
- :count => 100,
1164
- :credit => 10 }).should == @invitation_created
1175
+ :count => 100,
1176
+ :credit => 10 }).should == @invitation_created
1165
1177
  end
1166
1178
 
1167
1179
  it 'should create an invitationfor a specific user' do
1168
1180
  tropo_provisioning.create_invitation('15909',
1169
- { :code => 'ABC457',
1170
- :count => 100,
1171
- :credit => 10 }).should == @invitation_created
1181
+ { :code => 'ABC457',
1182
+ :count => 100,
1183
+ :credit => 10 }).should == @invitation_created
1172
1184
  end
1173
1185
 
1174
1186
  it 'should update an invitation' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tropo-provisioning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -155,6 +155,7 @@ files:
155
155
  - LICENSE
156
156
  - README.rdoc
157
157
  - Rakefile
158
+ - changelog.md
158
159
  - examples/app_details.yml
159
160
  - examples/authenticate_account.rb
160
161
  - examples/config.yml
@@ -203,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
204
  version: '0'
204
205
  segments:
205
206
  - 0
206
- hash: 3855042342958238112
207
+ hash: 4140171583782304435
207
208
  required_rubygems_version: !ruby/object:Gem::Requirement
208
209
  none: false
209
210
  requirements:
@@ -212,10 +213,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
213
  version: '0'
213
214
  segments:
214
215
  - 0
215
- hash: 3855042342958238112
216
+ hash: 4140171583782304435
216
217
  requirements: []
217
218
  rubyforge_project: tropo-provisioning
218
- rubygems_version: 1.8.24
219
+ rubygems_version: 1.8.23
219
220
  signing_key:
220
221
  specification_version: 3
221
222
  summary: Library for interacting with the Tropo Provisioning API