naranya_ecm-sdk 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/naranya_ecm/rest/client.rb +20 -1
- data/lib/naranya_ecm-sdk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 467ad967f583b99568ef5a5813f02e829eb136b9
|
4
|
+
data.tar.gz: 33a7e0d374a67318784aa38c1b340ce7503fe92b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d7cb102824ae43c8be62977f3f3c5d18ea2f91112a964889a9d2c39878e568eb6bdafb6df3a787e69ef9a73f2404092ea4422b067b60a47940baef4115a5cb1
|
7
|
+
data.tar.gz: fbcbf67e0e9a7ab011d28a37c035b192587d3db0efe60882c0811ebd9da133ae664b1406d658f885bb2cb9ca050fda5d7a7a13fb3d12da5ecd64073c1a6e6136
|
@@ -1,10 +1,29 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'naranya_ecm/rest/errors'
|
3
3
|
require 'active_support/core_ext/hash/indifferent_access.rb'
|
4
|
+
require 'active_support/concern'
|
4
5
|
|
5
6
|
module NaranyaEcm::Rest
|
6
7
|
class Client
|
7
8
|
|
9
|
+
module HTTPartyPatch
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
|
12
|
+
included do
|
13
|
+
alias_method_chain :format, :patch
|
14
|
+
end
|
15
|
+
|
16
|
+
def format_with_patch(request, response)
|
17
|
+
current_time = Time.now.strftime("%Y-%m-%d %H:%M:%S %z")
|
18
|
+
http_method = request.http_method.name.split("::").last.upcase
|
19
|
+
path = request.path.to_s
|
20
|
+
content_length = response.headers['Content-Length']
|
21
|
+
@logger.send @level, "[#{HTTParty::Logger::ApacheLogger::TAG_NAME}] [#{current_time}] #{response.code} \"#{http_method} #{path}\" #{content_length || "-"} "
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
HTTParty::Logger::ApacheLogger.send :include, HTTPartyPatch
|
26
|
+
|
8
27
|
TOKEN_CACHE_KEY = 'naranya_ecm/client/client_token'
|
9
28
|
|
10
29
|
class << self
|
@@ -25,7 +44,7 @@ module NaranyaEcm::Rest
|
|
25
44
|
|
26
45
|
options[:logger] = NaranyaEcm.logger
|
27
46
|
options[:log_level] = :debug
|
28
|
-
options[:log_format] = :
|
47
|
+
options[:log_format] = :apache
|
29
48
|
|
30
49
|
response = HTTParty.send method, url, options
|
31
50
|
|