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 +4 -4
- data/lib/tr8n/api_client.rb +16 -3
- data/lib/tr8n/session.rb +1 -1
- data/lib/tr8n_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd361efe0829b3be413582a60908233081931b79
|
4
|
+
data.tar.gz: 324b069c69d605c6ec82682c13c00c7717367b74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f92d957e3f088ba3fbe94ad063bd3eedb31cf9addc94e87486dc47b9e17b0f67d8641d72d360dfe71a8abcae3e3a7d0a087b4bb6f99422cd8d26f12015f0895c
|
7
|
+
data.tar.gz: 925d69b2e088fe0239cf7426858961d0f1ac8102ef629ef47fe5d5c4fbed5812e3a16322fe9816e075f783cc9f44783bab4aff8c02e0af4f7c18fc23ad50b0b8
|
data/lib/tr8n/api_client.rb
CHANGED
@@ -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
|
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
|
-
|
111
|
-
|
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 =
|
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
|
|
data/lib/tr8n_core/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|