cc-terminal 0.1.1 → 0.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82dad100cc90d5e0d2aa39f2bf957e4f39829d60
4
- data.tar.gz: 99bb838690d6a384168975386b599e4702bed296
3
+ metadata.gz: 824b6749992e88f74e46ca0a771d3b3a5e4737a5
4
+ data.tar.gz: 2680c8d7ba9f1b40f58d771a28ae250b40c9da8b
5
5
  SHA512:
6
- metadata.gz: 0b5c6c5288c953746f48806508aa38a2da489a4f1655a417a0df1b8cacb65a73c5ca8af56dc57ee5323c9a3d0196ba68e78e30147df84872b20291ba669f15ff
7
- data.tar.gz: d3bf52bf6fde0d0b5af2e3453fa19b65f3211dc4a6d6cffc348c7c2d6a8f6ed70aeb27a9e5080a2c57e58649e5494d67522233d5b5db784ed9dc475bd2f8acd2
6
+ metadata.gz: 8d26804f2f147a260d9520103e7f17a050d2beada6ed5d7a14980c9a90631b7bc39f608a6b9ef05ee816f66e9c4f090b60989e6695eaeae3d467da00a302b682
7
+ data.tar.gz: cfbce493620884723fdf480033e24a249b5e80fe67efc1668e75d40ae4408253a1bfa19b5f5ce0ee865757c7a7c036262e275d5816082908b05d453db6b08c4e
@@ -29,8 +29,11 @@ module Terminal
29
29
  @connection ||= Faraday.new(API_URL, options) do | conn |
30
30
  conn.request :encode_json
31
31
  conn.adapter :net_http
32
- conn.response :parse_json
32
+
33
+ # This ordering is important don't change
33
34
  conn.response :raise_error_from_json
35
+ conn.response :parse_json
36
+
34
37
  end
35
38
  end
36
39
 
@@ -9,7 +9,7 @@ module Terminal
9
9
  # Terminal.com always returns 200
10
10
  code = response.status.to_i
11
11
 
12
- if code == 200 && response.body['success'] == false || !response.body['error'].nil?
12
+ if code == 200 && response.body[:success] == false || !response.body[:error].nil?
13
13
  fail(Terminal::APIResponseError.new(response))
14
14
  else
15
15
  # How did we get here?
@@ -1,3 +1,3 @@
1
1
  module Terminal
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1 +1 @@
1
- {"error":"No such user"}
1
+ {"status": "failed", "error":"No such user"}
@@ -20,3 +20,10 @@ def fixture(file)
20
20
  File.new(f_path + '/' + file)
21
21
  end
22
22
 
23
+ # spec_helper.rb
24
+ RSpec.configure do |config|
25
+ config.expect_with :rspec do |c|
26
+ c.syntax = [:should, :expect]
27
+ # config.raise_errors_for_deprecations!
28
+ end
29
+ end
@@ -9,7 +9,7 @@ describe Terminal::Client do
9
9
 
10
10
  context 'when bad access_token,user_token are provided' do
11
11
  it 'raises a configuration exception' do
12
- expect { Terminal::Client.new(:access_token => 12121, :user_token => 12111111) }.to raise_exception(Terminal::APIConfigurationError)
12
+ expect { Terminal::Client.new(:access_token => 12121, :user_token => 12111111) }.to raise_exception(Terminal::APIConfigurationError)
13
13
  end
14
14
  end
15
15
  context 'when no access_token,user_token are provided' do
@@ -33,7 +33,10 @@ describe Terminal::Client do
33
33
 
34
34
  it 'raises an API error from a response containing error JSON' do
35
35
  stub_post('/path').to_return(:body => fixture('error_response.json'), :headers => {:content_type => 'application/json'})
36
- expect { @client.send(:request, :post, '/path')}.to raise_error(Terminal::APIResponseError)
36
+ expect { @client.send(:request, :post, '/path') }.to raise_error { |e|
37
+ e.should be_a(Terminal::APIResponseError)
38
+ e.response.body[:status].should equal?('failed')
39
+ }
37
40
  end
38
41
  end
39
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cc-terminal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timor Tsentsiper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json