brm_client 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ begin
17
17
  Jeweler::Tasks.new do |gem|
18
18
  gem.name = "brm_client"
19
19
  gem.summary = "BRM Event logging client"
20
- gem.description = ""
20
+ gem.description = "BRM Event logging client library"
21
21
  gem.email = "sbellity@gmail.com"
22
22
  gem.homepage = "http://github.com/sbellity/brm_client"
23
23
  gem.authors = ["Stephane Bellity"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -0,0 +1,70 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{brm_client}
8
+ s.version = "0.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Stephane Bellity"]
12
+ s.date = %q{2010-03-15}
13
+ s.description = %q{BRM Event logging client library}
14
+ s.email = %q{sbellity@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "brm_client.gemspec",
27
+ "lib/brm_client.rb",
28
+ "lib/brm_client/event.rb",
29
+ "lib/brm_client/gateway.rb",
30
+ "lib/brm_client/gateway/amqp.rb",
31
+ "lib/brm_client/gateway/file.rb",
32
+ "lib/brm_client/gateway/mongo.rb",
33
+ "lib/brm_client/logger.rb",
34
+ "spec/brm_client_spec.rb",
35
+ "spec/spec.opts",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/sbellity/brm_client}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.6}
42
+ s.summary = %q{BRM Event logging client}
43
+ s.test_files = [
44
+ "spec/brm_client_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
53
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
54
+ s.add_runtime_dependency(%q<bunny>, [">= 0"])
55
+ s.add_runtime_dependency(%q<mongo>, [">= 0.18.3"])
56
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
57
+ else
58
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
59
+ s.add_dependency(%q<bunny>, [">= 0"])
60
+ s.add_dependency(%q<mongo>, [">= 0.18.3"])
61
+ s.add_dependency(%q<activesupport>, [">= 0"])
62
+ end
63
+ else
64
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
65
+ s.add_dependency(%q<bunny>, [">= 0"])
66
+ s.add_dependency(%q<mongo>, [">= 0.18.3"])
67
+ s.add_dependency(%q<activesupport>, [">= 0"])
68
+ end
69
+ end
70
+
@@ -10,10 +10,13 @@ module BrmClient
10
10
  attr_reader :gateway, :application
11
11
  attr_accessor :facet_id, :user_id
12
12
 
13
- def initialize(application, gateway_type, *args)
13
+ def initialize(application, gateway_options = {}, *opts)
14
14
  @application = application
15
- gateway_options = args.extract_options! || {}
16
- gateway_options[:application] = application
15
+ @options = {
16
+ :timestamp_format => "time"
17
+ }.merge(opts.extract_options! || {})
18
+ gateway_type = gateway_options.delete("type") || "File"
19
+ gateway_options[:application] ||= application
17
20
  @gateway = BrmClient::Gateway.const_get(gateway_type).new(gateway_options)
18
21
  end
19
22
 
@@ -38,10 +41,19 @@ module BrmClient
38
41
  event["data"]["agent"] ||= {:id => user_id, :type => "user"}
39
42
  event["context"]["userID"] = user_id
40
43
  end
44
+
45
+ puts "timestamp_format : #{@options[:timestamp_format]}"
46
+
47
+ timestamp = case @options[:timestamp_format]
48
+ when "timestamp" then Time.now.to_i * 1000
49
+ when "string" then (Time.now.to_i * 1000).to_s
50
+ else Time.now
51
+ end
52
+
41
53
  event["metaData"] = {
42
- "timestamp" => Time.now.to_i * 1000,
43
54
  "eventName" => event_name,
44
55
  "application" => application,
56
+ "timestamp" => timestamp,
45
57
  "loggerVersion" => VERSION,
46
58
  "loggerType" => "ruby",
47
59
  "sequenceNumber" => sequence_number
@@ -51,7 +63,5 @@ module BrmClient
51
63
  send_event event
52
64
  end
53
65
 
54
-
55
-
56
66
  end
57
67
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephane Bellity
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-10 00:00:00 +01:00
17
+ date: 2010-03-15 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: "0"
70
70
  type: :runtime
71
71
  version_requirements: *id004
72
- description: ""
72
+ description: BRM Event logging client library
73
73
  email: sbellity@gmail.com
74
74
  executables: []
75
75
 
@@ -85,6 +85,7 @@ files:
85
85
  - README.rdoc
86
86
  - Rakefile
87
87
  - VERSION
88
+ - brm_client.gemspec
88
89
  - lib/brm_client.rb
89
90
  - lib/brm_client/event.rb
90
91
  - lib/brm_client/gateway.rb