naranya_ecm-sdk 0.0.22 → 0.0.23

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: 20a4b429a7766689ea2293c0a41baa1bea0ed2a6
4
- data.tar.gz: 64c613182dc0d62efef100fb9fa9b076cf79b836
3
+ metadata.gz: d79823461b0001b4f7559d10806b5d80c9010fcf
4
+ data.tar.gz: b8302cc1f957e309f4d7d45e33c1507c4565204d
5
5
  SHA512:
6
- metadata.gz: 10fe08ac351446064dd7851832fb8323312d7cc8a3596f6eab1a8216d9171241216b8b590b95978f58cfcc2f75e00886d2bba9819d5839174073ec87c6b9db3f
7
- data.tar.gz: a420aa44fad26068128612cc9c775bf9c8fd352f2c450d2d340407a6d661dbf80c026bb0ff973dcde283a7a13dfadc98dc63a269fdad425994ccf273e9f39f49
6
+ metadata.gz: 52cd6c2eb08f9bf803d6a87473fce85c2efd5e39f95f3592f5c371eb88fc32a6f23bf863d0f587301723f442827c371ae4612a87e5c59a482e4dd89c52a8ab0a
7
+ data.tar.gz: 8da103e715e0b4484bfd75b1ecaf954269c0406d2c139692bd4511ab3c2506fd75ad8db620d5281af3f63c06cd23de80c4c909141e3ec143d1e7863bd228ecc1
@@ -86,6 +86,11 @@ module NaranyaEcm
86
86
  @cache ||= ActiveSupport::Cache.lookup_store *options[:cache]
87
87
  end
88
88
 
89
+ def logger
90
+ auto_conf unless config.present?
91
+ @logger ||= Logger.new($stdout)
92
+ end
93
+
89
94
  def load_config_from_yml(yml_path, env="production")
90
95
  raise "YAML file doesn't extst" unless File.exist?(yml_path)
91
96
  yml_config = DEFAULT_CONFIG.merge(YAML::load(ERB.new(File.read(yml_path)).result)[env])
@@ -103,6 +108,9 @@ module NaranyaEcm
103
108
 
104
109
  # Use the Rails cache:
105
110
  @cache = Rails.cache
111
+
112
+ # Use the Rails logger:
113
+ @logger = Rails.logger
106
114
  elsif File.exists?('./naranya_ecm.yml')
107
115
  load_config_from_yml('./naranya_ecm.yml')
108
116
  end
@@ -1,3 +1,3 @@
1
1
  module NaranyaEcm
2
- VERSION = "0.0.22"
2
+ VERSION = "0.0.23"
3
3
  end
@@ -22,7 +22,11 @@ module NaranyaEcm::Rest
22
22
 
23
23
  options[:headers] = {} unless options.has_key? :headers
24
24
  options[:headers]['Authorization'] = authorization_header
25
-
25
+
26
+ options[:logger] = NaranyaEcm.logger
27
+ options[:log_level] = :debug
28
+ options[:log_format] = :curl
29
+
26
30
  response = HTTParty.send method, url, options
27
31
 
28
32
  # Retry if response code is 422 and a client token is present:
@@ -46,7 +50,10 @@ module NaranyaEcm::Rest
46
50
  @authorization_header ||= NaranyaEcm.cache.fetch(TOKEN_CACHE_KEY) do
47
51
  token_response = HTTParty.post "#{NaranyaEcm.options[:site]}/oauth/token",
48
52
  basic_auth: { username: NaranyaEcm.options[:api_key], password: NaranyaEcm.options[:api_secret] },
49
- body: { grant_type: "client_credentials" }
53
+ body: { grant_type: "client_credentials" },
54
+ logger: NaranyaEcm.logger,
55
+ log_level: :debug,
56
+ log_format: :curl
50
57
 
51
58
  ::NaranyaEcm::Rest::RestError.raise_by_code(token_response.code) unless token_response.success?
52
59
 
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.22
4
+ version: 0.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla