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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf20207d60a657eefbe8a9834786b1e4e6bacaf3
4
- data.tar.gz: 09882c4e68b668d1e9fb5f39f85a0026d2b37d7d
3
+ metadata.gz: 467ad967f583b99568ef5a5813f02e829eb136b9
4
+ data.tar.gz: 33a7e0d374a67318784aa38c1b340ce7503fe92b
5
5
  SHA512:
6
- metadata.gz: e04be8b969c1e197a1cf4eb4b214fe880cc689a6315cb801c7e15d4babf4d7553be6657aab492a213ab07eb243fe2f71d1251aecbfa69c027d015616d6dfa88b
7
- data.tar.gz: 41e8ed68137abf1344aac612c3dd4085019beac051aca18fa2aa8ccf8285df6b1d7183607f50c43f84a25e8188da3a30ef4058afb961b0bc2c5e4783ee91ff13
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] = :curl
47
+ options[:log_format] = :apache
29
48
 
30
49
  response = HTTParty.send method, url, options
31
50
 
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: naranya_ecm-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla