heroku-api 0.3.21 → 0.3.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04b8ff21deb9427d5860d5f8dd1bd4e05609eb41
4
- data.tar.gz: d5e1e0bf21c9b40ac7ea13c3f82c6b65108a3b76
3
+ metadata.gz: 434482948bc8d5f809db1048dcbef21771504659
4
+ data.tar.gz: e15ea53a53442eb11ffe0e63f1c049eed185c716
5
5
  SHA512:
6
- metadata.gz: 3fde62225cd96770d0bb98728b0ca0a4b530446e7c7f009534e6e86361594f9615fad9f46b81443ce01d278b9857e46284b8facd542c31df948233f6a31ebea5
7
- data.tar.gz: d3c0f1e7ebfbbf02671865a2b4cf268c641833bda813bfcb0a92b473cbe9e1997b93cfd2c6e01f68805de7e9d9387b0c632337e8a38653dd8b3f108a7625a764
6
+ metadata.gz: 680285bd3768719b2881e531bbd3a7a640be161d1df08ebf3ddb75e002634642e70ac35a107af1dbdec76b054b57119f4f0274cff4c251efd7b7c26c114726b7
7
+ data.tar.gz: d8a95ce1310a015615023bfeef901b12130c0aa46e0d4be85dcb6b63655612599d1a2589cbe677cf3a6202265937841053e855b6a92dce29addb4adaebb3530d
data/.travis.yml CHANGED
@@ -10,7 +10,6 @@ notifications:
10
10
 
11
11
  rvm:
12
12
  - 1.8.7
13
- - 1.9.2
14
13
  - 1.9.3
15
14
  - 2.0.0
16
15
  - 2.1.0
data/changelog.txt CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.22 12/17/2014
2
+ =================
3
+ add two factor capabilities
4
+
1
5
  0.3.21 12/03/2014
2
6
  =================
3
7
  fix tests/mocks to match new cached data
@@ -6,7 +10,6 @@ fix tests/mocks to match new cached data
6
10
  =================
7
11
  update mock data cache
8
12
 
9
-
10
13
  0.3.18 03/20/2014
11
14
  =================
12
15
 
data/lib/heroku/api.rb CHANGED
@@ -52,6 +52,8 @@ module Heroku
52
52
  :scheme => 'https'
53
53
  }
54
54
 
55
+ attr_accessor :second_factor
56
+
55
57
  def initialize(options={})
56
58
  options = OPTIONS.merge(options)
57
59
 
@@ -73,6 +75,11 @@ module Heroku
73
75
 
74
76
  def request(params, &block)
75
77
  begin
78
+ if @second_factor
79
+ params[:headers] ||= {}
80
+ params[:headers]['Heroku-Two-Factor-Code'] = @second_factor
81
+ @second_factor = nil # don't use the token again
82
+ end
76
83
  response = @connection.request(params, &block)
77
84
  rescue Excon::Errors::HTTPStatusError => error
78
85
  klass = case error.response.status
@@ -1,5 +1,5 @@
1
1
  module Heroku
2
2
  class API
3
- VERSION = "0.3.21"
3
+ VERSION = "0.3.22"
4
4
  end
5
5
  end
@@ -0,0 +1,13 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+
3
+ class TestSecondFactor < Minitest::Test
4
+
5
+ def test_second_factor_cleared
6
+ # this test just checks to see if the token is cleared
7
+ _heroku_ = heroku
8
+ _heroku_.second_factor = 'ccccccdhtnjniifelbvgblltgeigleglenfbvnkgvtlb'
9
+ _heroku_.get_user
10
+
11
+ assert_nil(_heroku_.second_factor)
12
+ end
13
+ 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.21
4
+ version: 0.3.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - geemus (Wesley Beary)
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-03 00:00:00.000000000 Z
12
+ date: 2014-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
@@ -135,6 +135,7 @@ files:
135
135
  - test/test_logs.rb
136
136
  - test/test_processes.rb
137
137
  - test/test_releases.rb
138
+ - test/test_second_factor.rb
138
139
  - test/test_ssl_endpoints.rb
139
140
  - test/test_stacks.rb
140
141
  - test/test_user.rb
@@ -179,6 +180,7 @@ test_files:
179
180
  - test/test_logs.rb
180
181
  - test/test_processes.rb
181
182
  - test/test_releases.rb
183
+ - test/test_second_factor.rb
182
184
  - test/test_ssl_endpoints.rb
183
185
  - test/test_stacks.rb
184
186
  - test/test_user.rb