heroku-api 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/changelog.txt +9 -0
- data/heroku-api.gemspec +1 -1
- data/lib/heroku/api.rb +1 -0
- data/lib/heroku/api/vendor/okjson.rb +59 -69
- data/lib/heroku/api/version.rb +1 -1
- data/test/data/site.crt +19 -0
- data/test/data/site.key +27 -0
- data/test/test_helper.rb +4 -4
- data/test/test_ssl_endpoints.rb +41 -34
- metadata +15 -15
- data/test/data/server.crt +0 -20
- data/test/data/server.key +0 -27
data/changelog.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
0.3.3 09/15/2012
|
2
|
+
================
|
3
|
+
|
4
|
+
update to more realistic self signed cert in tests
|
5
|
+
update body format for delete_ssl_endpoint
|
6
|
+
vendor latest okjson
|
7
|
+
patch okjson to work around encoding bug
|
8
|
+
bump excon and use blocking requests
|
9
|
+
|
1
10
|
0.3.2 08/01/2012
|
2
11
|
================
|
3
12
|
|
data/heroku-api.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_runtime_dependency 'excon', '~>0.
|
19
|
+
s.add_runtime_dependency 'excon', '~>0.16.0'
|
20
20
|
|
21
21
|
s.add_development_dependency 'minitest'
|
22
22
|
s.add_development_dependency 'rake'
|
data/lib/heroku/api.rb
CHANGED
@@ -221,9 +221,9 @@ module Heroku
|
|
221
221
|
end
|
222
222
|
|
223
223
|
|
224
|
-
def nulltok(s); s[0,4] == 'null'
|
225
|
-
def truetok(s); s[0,4] == 'true'
|
226
|
-
def falsetok(s); s[0,5] == 'false'
|
224
|
+
def nulltok(s); s[0,4] == 'null' ? [:val, 'null', nil] : [] end
|
225
|
+
def truetok(s); s[0,4] == 'true' ? [:val, 'true', true] : [] end
|
226
|
+
def falsetok(s); s[0,5] == 'false' ? [:val, 'false', false] : [] end
|
227
227
|
|
228
228
|
|
229
229
|
def numtok(s)
|
@@ -236,6 +236,8 @@ module Heroku
|
|
236
236
|
else
|
237
237
|
[:val, m[0], Integer(m[0])]
|
238
238
|
end
|
239
|
+
else
|
240
|
+
[]
|
239
241
|
end
|
240
242
|
end
|
241
243
|
|
@@ -263,13 +265,13 @@ module Heroku
|
|
263
265
|
# Unquote will raise an error if q contains control characters.
|
264
266
|
def unquote(q)
|
265
267
|
q = q[1...-1]
|
266
|
-
a = q.dup # allocate a big enough string
|
267
268
|
rubydoesenc = false
|
268
269
|
# In ruby >= 1.9, a[w] is a codepoint, not a byte.
|
269
|
-
if
|
270
|
-
|
270
|
+
if q.class.method_defined?(:force_encoding)
|
271
|
+
q.force_encoding('UTF-8')
|
271
272
|
rubydoesenc = true
|
272
273
|
end
|
274
|
+
a = q.dup # allocate a big enough string
|
273
275
|
r, w = 0, 0
|
274
276
|
while r < q.length
|
275
277
|
c = q[r]
|
@@ -376,15 +378,6 @@ module Heroku
|
|
376
378
|
end
|
377
379
|
|
378
380
|
|
379
|
-
def unsubst(u)
|
380
|
-
if u < Usurrself || u > Umax || surrogate?(u)
|
381
|
-
return Ucharerr, Ucharerr
|
382
|
-
end
|
383
|
-
u -= Usurrself
|
384
|
-
[Usurr1 + ((u>>10)&0x3ff), Usurr2 + (u&0x3ff)]
|
385
|
-
end
|
386
|
-
|
387
|
-
|
388
381
|
def surrogate?(u)
|
389
382
|
Usurr1 <= u && u < Usurr3
|
390
383
|
end
|
@@ -474,15 +467,18 @@ module Heroku
|
|
474
467
|
else
|
475
468
|
c = s[r]
|
476
469
|
case true
|
470
|
+
when rubydoesenc
|
471
|
+
begin
|
472
|
+
c.ord # will raise an error if c is invalid UTF-8
|
473
|
+
t.write(c)
|
474
|
+
rescue
|
475
|
+
t.write(Ustrerr)
|
476
|
+
end
|
477
477
|
when Spc <= c && c <= ?~
|
478
478
|
t.putc(c)
|
479
|
-
when rubydoesenc
|
480
|
-
u = c.ord
|
481
|
-
surrenc(t, u)
|
482
479
|
else
|
483
|
-
|
484
|
-
r +=
|
485
|
-
surrenc(t, u)
|
480
|
+
n = ucharcopy(t, s, r) # ensure valid UTF-8 output
|
481
|
+
r += n - 1 # r is incremented below
|
486
482
|
end
|
487
483
|
end
|
488
484
|
r += 1
|
@@ -492,28 +488,6 @@ module Heroku
|
|
492
488
|
end
|
493
489
|
|
494
490
|
|
495
|
-
def surrenc(t, u)
|
496
|
-
if u < 0x10000
|
497
|
-
t.print('\\u')
|
498
|
-
hexenc4(t, u)
|
499
|
-
else
|
500
|
-
u1, u2 = unsubst(u)
|
501
|
-
t.print('\\u')
|
502
|
-
hexenc4(t, u1)
|
503
|
-
t.print('\\u')
|
504
|
-
hexenc4(t, u2)
|
505
|
-
end
|
506
|
-
end
|
507
|
-
|
508
|
-
|
509
|
-
def hexenc4(t, u)
|
510
|
-
t.putc(Hex[(u>>12)&0xf])
|
511
|
-
t.putc(Hex[(u>>8)&0xf])
|
512
|
-
t.putc(Hex[(u>>4)&0xf])
|
513
|
-
t.putc(Hex[u&0xf])
|
514
|
-
end
|
515
|
-
|
516
|
-
|
517
491
|
def numenc(x)
|
518
492
|
if ((x.nan? || x.infinite?) rescue false)
|
519
493
|
raise Error, "Numeric cannot be represented: #{x}"
|
@@ -522,60 +496,77 @@ module Heroku
|
|
522
496
|
end
|
523
497
|
|
524
498
|
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
|
499
|
+
# Copies the valid UTF-8 bytes of a single character
|
500
|
+
# from string s at position i to I/O object t, and
|
501
|
+
# returns the number of bytes copied.
|
502
|
+
# If no valid UTF-8 char exists at position i,
|
503
|
+
# ucharcopy writes Ustrerr and returns 1.
|
504
|
+
def ucharcopy(t, s, i)
|
529
505
|
n = s.length - i
|
530
|
-
|
506
|
+
raise Utf8Error if n < 1
|
531
507
|
|
532
508
|
c0 = s[i].ord
|
533
509
|
|
534
510
|
# 1-byte, 7-bit sequence?
|
535
511
|
if c0 < Utagx
|
536
|
-
|
512
|
+
t.putc(c0)
|
513
|
+
return 1
|
537
514
|
end
|
538
515
|
|
539
|
-
# unexpected continuation byte?
|
540
|
-
return [Ucharerr, 1] if c0 < Utag2
|
516
|
+
raise Utf8Error if c0 < Utag2 # unexpected continuation byte?
|
541
517
|
|
542
|
-
# need continuation byte
|
543
|
-
return [Ucharerr, 1] if n < 2
|
518
|
+
raise Utf8Error if n < 2 # need continuation byte
|
544
519
|
c1 = s[i+1].ord
|
545
|
-
|
520
|
+
raise Utf8Error if c1 < Utagx || Utag2 <= c1
|
546
521
|
|
547
522
|
# 2-byte, 11-bit sequence?
|
548
523
|
if c0 < Utag3
|
549
|
-
|
550
|
-
|
551
|
-
|
524
|
+
raise Utf8Error if ((c0&Umask2)<<6 | (c1&Umaskx)) <= Uchar1max
|
525
|
+
t.putc(c0)
|
526
|
+
t.putc(c1)
|
527
|
+
return 2
|
552
528
|
end
|
553
529
|
|
554
530
|
# need second continuation byte
|
555
|
-
|
531
|
+
raise Utf8Error if n < 3
|
532
|
+
|
556
533
|
c2 = s[i+2].ord
|
557
|
-
|
534
|
+
raise Utf8Error if c2 < Utagx || Utag2 <= c2
|
558
535
|
|
559
536
|
# 3-byte, 16-bit sequence?
|
560
537
|
if c0 < Utag4
|
561
538
|
u = (c0&Umask3)<<12 | (c1&Umaskx)<<6 | (c2&Umaskx)
|
562
|
-
|
563
|
-
|
539
|
+
raise Utf8Error if u <= Uchar2max
|
540
|
+
t.putc(c0)
|
541
|
+
t.putc(c1)
|
542
|
+
t.putc(c2)
|
543
|
+
return 3
|
564
544
|
end
|
565
545
|
|
566
546
|
# need third continuation byte
|
567
|
-
|
547
|
+
raise Utf8Error if n < 4
|
568
548
|
c3 = s[i+3].ord
|
569
|
-
|
549
|
+
raise Utf8Error if c3 < Utagx || Utag2 <= c3
|
570
550
|
|
571
551
|
# 4-byte, 21-bit sequence?
|
572
552
|
if c0 < Utag5
|
573
553
|
u = (c0&Umask4)<<18 | (c1&Umaskx)<<12 | (c2&Umaskx)<<6 | (c3&Umaskx)
|
574
|
-
|
575
|
-
|
576
|
-
|
554
|
+
raise Utf8Error if u <= Uchar3max
|
555
|
+
t.putc(c0)
|
556
|
+
t.putc(c1)
|
557
|
+
t.putc(c2)
|
558
|
+
t.putc(c3)
|
559
|
+
return 4
|
560
|
+
end
|
561
|
+
|
562
|
+
raise Utf8Error
|
563
|
+
rescue Utf8Error
|
564
|
+
t.write(Ustrerr)
|
565
|
+
return 1
|
566
|
+
end
|
567
|
+
|
577
568
|
|
578
|
-
|
569
|
+
class Utf8Error < ::StandardError
|
579
570
|
end
|
580
571
|
|
581
572
|
|
@@ -596,15 +587,14 @@ module Heroku
|
|
596
587
|
Uchar2max = (1<<11) - 1
|
597
588
|
Uchar3max = (1<<16) - 1
|
598
589
|
Ucharerr = 0xFFFD # unicode "replacement char"
|
590
|
+
Ustrerr = "\xef\xbf\xbd" # unicode "replacement char"
|
599
591
|
Usurrself = 0x10000
|
600
592
|
Usurr1 = 0xd800
|
601
593
|
Usurr2 = 0xdc00
|
602
594
|
Usurr3 = 0xe000
|
603
|
-
Umax = 0x10ffff
|
604
595
|
|
605
596
|
Spc = ' '[0]
|
606
597
|
Unesc = {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}
|
607
|
-
Hex = '0123456789abcdef'
|
608
598
|
end
|
609
599
|
end
|
610
600
|
end
|
data/lib/heroku/api/version.rb
CHANGED
data/test/data/site.crt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIC/jCCAeYCCQDqx6gBfaFHsjANBgkqhkiG9w0BAQUFADBBMQswCQYDVQQGEwJV
|
3
|
+
UzELMAkGA1UECBMCQ0ExDzANBgNVBAoTBkhlcm9rdTEUMBIGA1UEAxMLZXhhbXBs
|
4
|
+
ZS5jb20wHhcNMTIwODAxMjIzMjA5WhcNMTMwODAxMjIzMjA5WjBBMQswCQYDVQQG
|
5
|
+
EwJVUzEL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8u5obx
|
17
|
+
68eikKMc9gXf6hJTcNXbogf6t4+/v5oKgPVA6puPefZkt1Lswc1aR7NdC5tYmplc
|
18
|
+
C71WZISEONEQsTbp1c5QOJ69/gf325IE3sXb+vFDAoGAIy97WKKIHKu3JuI9bX0V
|
19
|
+
Xc1GOWz95S/MHxHwsOPeIaralKME/PzE20pL4ODc9o/XQ/7cwyRzXHj2tmeRKYGw
|
20
|
+
0OYqv5FJYdEqpqnrDSW45X+emZAbiUdp57PXQlGXpz50hU5ywfOxQOc/mYkvczAN
|
21
|
+
370TLlZr0kBGF0UXyzrYEDsCgYAlHm8qBAHtTb2hWMHgEMnwaZqJCyFkMH6vYi+b
|
22
|
+
xXVcZwONTT4L++xaekvjk5kEhC63Q79EKKPr+fBEB095Xvy89yT8zbxeiRjXpeUx
|
23
|
+
6f3D7Kk35n8tCJwMnFWvCc5D53idflCgZcIoWIUD/jOdI9vaq/Xjql9SnuVKOsvw
|
24
|
+
GrGMqwKBgQCytS+qZdQ8/OoDSO+iLQr7prVxAfzVwuPggTIoRKcdU83o/2O89ipY
|
25
|
+
zkcS+NcCD78phRydu9G6dFhDThkQYGcouF1tYpNqbjqqMoudcP35yE2+h3pzmiuV
|
26
|
+
hZIQ2YjfaWARcNX+881gDb7m6835lCFyAZ75z9xsSWpYb+4EVH0gjg==
|
27
|
+
-----END RSA PRIVATE KEY-----
|
data/test/test_helper.rb
CHANGED
@@ -8,12 +8,12 @@ require 'time'
|
|
8
8
|
DATA_PATH = File.expand_path("#{File.dirname(__FILE__)}/data")
|
9
9
|
MOCK = ENV['MOCK'] != 'false'
|
10
10
|
|
11
|
-
def
|
12
|
-
@
|
11
|
+
def data_site_crt
|
12
|
+
@data_site_crt ||= File.read(File.join(DATA_PATH, 'site.crt'))
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
@
|
15
|
+
def data_site_key
|
16
|
+
@data_site_key ||= File.read(File.join(DATA_PATH, 'site.key'))
|
17
17
|
end
|
18
18
|
|
19
19
|
def heroku
|
data/test/test_ssl_endpoints.rb
CHANGED
@@ -6,11 +6,18 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
6
6
|
skip if MOCK
|
7
7
|
with_app do |app_data|
|
8
8
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
9
|
-
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'],
|
9
|
+
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key).body
|
10
10
|
|
11
11
|
response = heroku.delete_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'])
|
12
12
|
|
13
|
-
|
13
|
+
data = response.body['ssl_cert']
|
14
|
+
assert_equal(false, data['ca_signed?'])
|
15
|
+
assert_equal(true, data['self_signed?'])
|
16
|
+
assert_equal(['example.com'], data['cert_domains'])
|
17
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
18
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
19
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
20
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
14
21
|
assert_equal(200, response.status)
|
15
22
|
end
|
16
23
|
end
|
@@ -26,18 +33,18 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
26
33
|
skip if MOCK
|
27
34
|
with_app do |app_data|
|
28
35
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
29
|
-
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'],
|
36
|
+
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key).body
|
30
37
|
|
31
38
|
response = heroku.get_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'])
|
32
39
|
|
33
40
|
data = response.body['ssl_cert']
|
34
41
|
assert_equal(false, data['ca_signed?'])
|
35
42
|
assert_equal(true, data['self_signed?'])
|
36
|
-
assert_equal(['
|
37
|
-
assert_equal('2013/
|
38
|
-
assert_equal('/C=US/O=Heroku/CN=
|
39
|
-
assert_equal('2012/
|
40
|
-
assert_equal('/C=US/O=Heroku/CN=
|
43
|
+
assert_equal(['example.com'], data['cert_domains'])
|
44
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
45
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
46
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
47
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
41
48
|
assert_equal(200, response.status)
|
42
49
|
end
|
43
50
|
end
|
@@ -46,18 +53,18 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
46
53
|
skip if MOCK
|
47
54
|
with_app do |app_data|
|
48
55
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
49
|
-
heroku.post_ssl_endpoint(app_data['name'],
|
56
|
+
heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key)
|
50
57
|
|
51
58
|
response = heroku.get_ssl_endpoints(app_data['name'])
|
52
59
|
|
53
60
|
data = response.body.first['ssl_cert']
|
54
61
|
assert_equal(false, data['ca_signed?'])
|
55
62
|
assert_equal(true, data['self_signed?'])
|
56
|
-
assert_equal(['
|
57
|
-
assert_equal('2013/
|
58
|
-
assert_equal('/C=US/O=Heroku/CN=
|
59
|
-
assert_equal('2012/
|
60
|
-
assert_equal('/C=US/O=Heroku/CN=
|
63
|
+
assert_equal(['example.com'], data['cert_domains'])
|
64
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
65
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
66
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
67
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
61
68
|
assert_equal(200, response.status)
|
62
69
|
end
|
63
70
|
end
|
@@ -67,16 +74,16 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
67
74
|
with_app do |app_data|
|
68
75
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
69
76
|
|
70
|
-
response = heroku.post_ssl_endpoint(app_data['name'],
|
77
|
+
response = heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key)
|
71
78
|
|
72
79
|
data = response.body['ssl_cert']
|
73
80
|
assert_equal(false, data['ca_signed?'])
|
74
81
|
assert_equal(true, data['self_signed?'])
|
75
|
-
assert_equal(['
|
76
|
-
assert_equal('2013/
|
77
|
-
assert_equal('/C=US/O=Heroku/CN=
|
78
|
-
assert_equal('2012/
|
79
|
-
assert_equal('/C=US/O=Heroku/CN=
|
82
|
+
assert_equal(['example.com'], data['cert_domains'])
|
83
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
84
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
85
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
86
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
80
87
|
assert_equal(200, response.status)
|
81
88
|
end
|
82
89
|
end
|
@@ -85,19 +92,19 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
85
92
|
skip if MOCK
|
86
93
|
with_app do |app_data|
|
87
94
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
88
|
-
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'],
|
89
|
-
heroku.put_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'],
|
95
|
+
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key).body
|
96
|
+
heroku.put_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'], data_site_crt, data_site_key)
|
90
97
|
|
91
98
|
response = heroku.post_ssl_endpoint_rollback(app_data['name'], ssl_endpoint_data['cname'])
|
92
99
|
|
93
100
|
data = response.body['ssl_cert']
|
94
101
|
assert_equal(false, data['ca_signed?'])
|
95
102
|
assert_equal(true, data['self_signed?'])
|
96
|
-
assert_equal(['
|
97
|
-
assert_equal('2013/
|
98
|
-
assert_equal('/C=US/O=Heroku/CN=
|
99
|
-
assert_equal('2012/
|
100
|
-
assert_equal('/C=US/O=Heroku/CN=
|
103
|
+
assert_equal(['example.com'], data['cert_domains'])
|
104
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
105
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
106
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
107
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
101
108
|
assert_equal(200, response.status)
|
102
109
|
end
|
103
110
|
end
|
@@ -106,18 +113,18 @@ class TestSslEndpoints < MiniTest::Unit::TestCase
|
|
106
113
|
skip if MOCK
|
107
114
|
with_app do |app_data|
|
108
115
|
heroku.post_addon(app_data['name'], 'ssl:endpoint')
|
109
|
-
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'],
|
116
|
+
ssl_endpoint_data = heroku.post_ssl_endpoint(app_data['name'], data_site_crt, data_site_key).body
|
110
117
|
|
111
|
-
response = heroku.put_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'],
|
118
|
+
response = heroku.put_ssl_endpoint(app_data['name'], ssl_endpoint_data['cname'], data_site_crt, data_site_key)
|
112
119
|
|
113
120
|
data = response.body['ssl_cert']
|
114
121
|
assert_equal(false, data['ca_signed?'])
|
115
122
|
assert_equal(true, data['self_signed?'])
|
116
|
-
assert_equal(['
|
117
|
-
assert_equal('2013/
|
118
|
-
assert_equal('/C=US/O=Heroku/CN=
|
119
|
-
assert_equal('2012/
|
120
|
-
assert_equal('/C=US/O=Heroku/CN=
|
123
|
+
assert_equal(['example.com'], data['cert_domains'])
|
124
|
+
assert_equal('2013/08/01 15:32:09 -0700', data['expires_at'])
|
125
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['issuer'])
|
126
|
+
assert_equal('2012/08/01 15:32:09 -0700', data['starts_at'])
|
127
|
+
assert_equal('/C=US/ST=CA/O=Heroku/CN=example.com', data['subject'])
|
121
128
|
assert_equal(200, response.status)
|
122
129
|
end
|
123
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
16
|
-
requirement: &
|
16
|
+
requirement: &70255687099020 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.16.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70255687099020
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70255687097700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70255687097700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70255687096380 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70255687096380
|
47
47
|
description: Ruby Client for the Heroku API
|
48
48
|
email:
|
49
49
|
- wesley@heroku.com
|
@@ -94,8 +94,8 @@ files:
|
|
94
94
|
- lib/heroku/api/user.rb
|
95
95
|
- lib/heroku/api/vendor/okjson.rb
|
96
96
|
- lib/heroku/api/version.rb
|
97
|
-
- test/data/
|
98
|
-
- test/data/
|
97
|
+
- test/data/site.crt
|
98
|
+
- test/data/site.key
|
99
99
|
- test/test_addons.rb
|
100
100
|
- test/test_apps.rb
|
101
101
|
- test/test_collaborators.rb
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 4015370602863934234
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
none: false
|
131
131
|
requirements:
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
segments:
|
136
136
|
- 0
|
137
|
-
hash:
|
137
|
+
hash: 4015370602863934234
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
140
|
rubygems_version: 1.8.15
|
@@ -142,8 +142,8 @@ signing_key:
|
|
142
142
|
specification_version: 3
|
143
143
|
summary: Ruby Client for the Heroku API
|
144
144
|
test_files:
|
145
|
-
- test/data/
|
146
|
-
- test/data/
|
145
|
+
- test/data/site.crt
|
146
|
+
- test/data/site.key
|
147
147
|
- test/test_addons.rb
|
148
148
|
- test/test_apps.rb
|
149
149
|
- test/test_collaborators.rb
|
data/test/data/server.crt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
2
|
-
MIIDPDCC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