amiando 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'typhoeus'
22
22
  s.add_dependency 'multi_json'
23
23
 
24
- s.add_development_dependency 'minitest'
24
+ s.add_development_dependency 'minitest', '2.9.0'
25
25
  s.add_development_dependency 'webmock'
26
26
  s.add_development_dependency 'rake'
27
27
  end
@@ -15,18 +15,25 @@ module Amiando
15
15
  super(path, :method => verb, :params => params, :verbose => Amiando.verbose)
16
16
  end
17
17
 
18
+ def log_request
19
+ if Amiando.logger && Amiando.logger.debug?
20
+ Amiando.logger.debug "#{self.method.to_s.upcase} request #{filter_log(url)} with body #{filter_log(self.params.inspect)}"
21
+ end
22
+ end
23
+
18
24
  def log_response
19
25
  if Amiando.logger
20
- filtered_url = url.gsub(/password=([^&]+)/, "password=[FILTERED]")
21
- Amiando.logger.info "REST request #{filtered_url} returned #{response.code} and took #{response.time} seconds"
22
-
26
+ Amiando.logger.info "#{self.method.to_s.upcase} request #{filter_log(url)} returned #{response.code} and took #{response.time} seconds"
23
27
  if Amiando.logger.debug? && response.body
24
- filtered_body = response.body.inspect.gsub(/password: .*/,'password: [FILTERED]')
25
- Amiando.logger.debug "REST request body: #{filtered_body}"
28
+ Amiando.logger.debug "#{self.method.to_s.upcase} response body: #{filter_log(response.body.inspect)}"
26
29
  end
27
30
  end
28
31
  end
29
32
 
33
+ def filter_log(text)
34
+ text.gsub(/password=([^&]+)/, "password=[FILTERED]").gsub(/password: .*/,'password: [FILTERED]')
35
+ end
36
+
30
37
  private
31
38
 
32
39
  def default_params
@@ -60,6 +60,8 @@ module Amiando
60
60
  req = Request.new(object, verb, path, options[:params] || {})
61
61
  object.request = req
62
62
 
63
+ req.log_request
64
+
63
65
  req.on_complete do |response|
64
66
  req.log_response
65
67
 
@@ -1,3 +1,3 @@
1
1
  module Amiando
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amiando
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jorge Dias
@@ -16,7 +16,8 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-04 00:00:00 Z
19
+ date: 2011-12-15 00:00:00 +01:00
20
+ default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: typhoeus
@@ -52,12 +53,14 @@ dependencies:
52
53
  requirement: &id003 !ruby/object:Gem::Requirement
53
54
  none: false
54
55
  requirements:
55
- - - ">="
56
+ - - "="
56
57
  - !ruby/object:Gem::Version
57
- hash: 3
58
+ hash: 43
58
59
  segments:
60
+ - 2
61
+ - 9
59
62
  - 0
60
- version: "0"
63
+ version: 2.9.0
61
64
  type: :development
62
65
  version_requirements: *id003
63
66
  - !ruby/object:Gem::Dependency
@@ -220,6 +223,7 @@ files:
220
223
  - test/support/factory.rb
221
224
  - test/support/hydra_cache.rb
222
225
  - test/test_helper.rb
226
+ has_rdoc: true
223
227
  homepage: ""
224
228
  licenses: []
225
229
 
@@ -249,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
253
  requirements: []
250
254
 
251
255
  rubyforge_project: amiando
252
- rubygems_version: 1.8.10
256
+ rubygems_version: 1.6.2
253
257
  signing_key:
254
258
  specification_version: 3
255
259
  summary: A ruby client for the amiando REST API