nowa-top4r 0.0.3 → 0.0.4

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.
@@ -10,6 +10,7 @@ class Top4R::Client
10
10
 
11
11
  def init
12
12
  total_results = 0
13
+ @@logger = Top4R::Logger.new(@@config.logger)
13
14
  if @parameters and @session
14
15
  @parameters = Base64.decode64(@parameters).split('&').inject({}) do |hsh, i| kv = i.split('='); hsh[kv[0]] = kv[1]; hsh end
15
16
  @login = user(@parameters['visitor_nick'])
data/lib/top4r/config.rb CHANGED
@@ -27,7 +27,8 @@ module Top4R
27
27
  :application_version,
28
28
  :application_url,
29
29
  :user_agent,
30
- :source
30
+ :source,
31
+ :logger
31
32
  ]
32
33
  attr_accessor *@@ATTRIBUTES
33
34
 
@@ -66,9 +67,11 @@ module Top4R
66
67
  :application_version => Top4R::Version.to_version,
67
68
  :application_url => 'http://top4r.nowa.me',
68
69
  :user_agent => 'default',
69
- :source => 'top4r'
70
+ :source => 'top4r',
71
+ :logger => nil
70
72
  }
71
73
  @@config = Top4R::Config.new(@@defaults)
74
+ @@logger = Top4R::Logger.new(@@config.logger)
72
75
 
73
76
  # Top4R::Client class methods
74
77
  class << self
@@ -0,0 +1,17 @@
1
+ class Top4R::Logger
2
+ class << self
3
+ def set_logger(logger)
4
+ self.new logger
5
+ end
6
+ end
7
+
8
+ class Nogger
9
+ def info(log)
10
+ puts log
11
+ end
12
+ end
13
+
14
+ def initialize(logger)
15
+ @logger = logger || Nogger.new
16
+ end
17
+ end
data/lib/top4r/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Top4R::Version
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- REVISION = 3
4
+ REVISION = 4
5
5
 
6
6
  class << self
7
7
  # Returns X.Y.Z formatted version string
data/lib/top4r.rb CHANGED
@@ -18,6 +18,7 @@ require 'activesupport'
18
18
 
19
19
  require_local('top4r/ext')
20
20
  require_local('top4r/version')
21
+ require_local('top4r/logger')
21
22
  require_local('top4r/meta')
22
23
  require_local('top4r/core')
23
24
  require_local('top4r/model')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nowa-top4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nowa Zhu
@@ -45,6 +45,7 @@ files:
45
45
  - lib/top4r/core.rb
46
46
  - lib/top4r/ext/stdlib.rb
47
47
  - lib/top4r/ext.rb
48
+ - lib/top4r/logger.rb
48
49
  - lib/top4r/meta.rb
49
50
  - lib/top4r/model/shipping.rb
50
51
  - lib/top4r/model/suite.rb