tr8n_core 4.0.13 → 4.0.14

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: dca2df7d8abff227fe6cd78b14724655e1e111a0
4
- data.tar.gz: d96499b858853cb354e8bc0f518fc92fe58e37df
3
+ metadata.gz: dd361efe0829b3be413582a60908233081931b79
4
+ data.tar.gz: 324b069c69d605c6ec82682c13c00c7717367b74
5
5
  SHA512:
6
- metadata.gz: fe7f3e60226a364b1f95e9876bfcf60a229ea3d5c39f0fe956faeb64a1daa95968e75f1ad8287e04529d51c81c5345d8e9f0157314e419716e16e3c0efaad45b
7
- data.tar.gz: 3a4308861adb7328031deb12d362026d8c57e8b04cf1fac065050b105a155cc352db6c82d99103f1db78c2f0ffe27ba04056fba462e2b03ffa5a1461110531e3
6
+ metadata.gz: f92d957e3f088ba3fbe94ad063bd3eedb31cf9addc94e87486dc47b9e17b0f67d8641d72d360dfe71a8abcae3e3a7d0a087b4bb6f99422cd8d26f12015f0895c
7
+ data.tar.gz: 925d69b2e088fe0239cf7426858961d0f1ac8102ef629ef47fe5d5c4fbed5812e3a16322fe9816e075f783cc9f44783bab4aff8c02e0af4f7c18fc23ad50b0b8
@@ -92,6 +92,7 @@ class Tr8n::ApiClient < Tr8n::Base
92
92
  def execute_request(path, params = {}, opts = {})
93
93
  response = nil
94
94
  error = nil
95
+
95
96
  Tr8n.logger.trace_api_call(path, params) do
96
97
  begin
97
98
  if opts[:method] == :post
@@ -99,7 +100,7 @@ class Tr8n::ApiClient < Tr8n::Base
99
100
  else
100
101
  response = connection.get("#{API_PATH}#{path}", params)
101
102
  end
102
- rescue Faraday::ConnectionFailed => ex
103
+ rescue Exception => ex
103
104
  Tr8n.logger.error("Failed to execute request: #{ex}")
104
105
  error = ex
105
106
  nil
@@ -107,8 +108,20 @@ class Tr8n::ApiClient < Tr8n::Base
107
108
  end
108
109
  raise Tr8n::Exception.new("Error: #{error}") if error
109
110
 
110
- data = JSON.parse(response.body)
111
- raise Tr8n::Exception.new("Error: #{data["error"]}") unless data["error"].nil?
111
+ if response.status >= 500 and response.status < 600
112
+ raise Tr8n::Exception.new("Error: #{response.body}")
113
+ end
114
+
115
+ begin
116
+ data = JSON.parse(response.body)
117
+ rescue Exception => ex
118
+ raise Tr8n::Exception.new("Error: #{ex}")
119
+ end
120
+
121
+ unless data["error"].nil?
122
+ raise Tr8n::Exception.new("Error: #{data["error"]}")
123
+ end
124
+
112
125
  data
113
126
  end
114
127
 
data/lib/tr8n/session.rb CHANGED
@@ -49,7 +49,7 @@ module Tr8n
49
49
  host ||= Tr8n.config.application[:host]
50
50
 
51
51
  Tr8n.cache.reset_version
52
- self.current_source = "/tr8n/core" # default source
52
+ self.current_source = '/tr8n/core' # default source
53
53
  self.application = Tr8n::Application.new(:host => host, :key => key, :secret => secret).fetch
54
54
  end
55
55
 
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module Tr8nCore
33
- VERSION = '4.0.13'
33
+ VERSION = '4.0.14'
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tr8n_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.13
4
+ version: 4.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2014-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday