megaphone-client 0.2.0 → 0.3.0

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: 898f4838e1b445a91974f65ffad3f32e65231eae
4
- data.tar.gz: 460c69341742e3e7173034ec05b1dacb91cc6206
3
+ metadata.gz: 1c576c3f15678249216b1f429627540da6a460a7
4
+ data.tar.gz: 30d95da0710f722658bc57e1577b0134bbf3c546
5
5
  SHA512:
6
- metadata.gz: 11d54f2d08d3f27fa16c66e5a3ebca2a9dfe4931aa0ee5e0af56c0ec234703078e9d362a6cb7d3c7a4a7a4ebbf1aac55152d66fc2dc8702f6b71088b719e0e3f
7
- data.tar.gz: b77d97d955b444e681cea5007efb1b2545000dff7541b4a57fee02fef7c083ea19bd8930009043f1a54ade07ec0ac9cc73c44d869e55468ffbaa8dfc4e15adac
6
+ metadata.gz: 503ccc117d9a16f0717db386ef47a02ab51fd44eaaca158d4f5d8cf7929c64926d715a07e4fb0562898d088d6178f1ed9452c5aba7059f70d435c8890e8dd5c2
7
+ data.tar.gz: 786ad699334f6222eb70a9efd1bf1fb350683812a07121d1ffc75286cd44ff72c496ba5de66aeb85896f9d13e2914f744facbbb083c4dadc56a2031d17c996dc
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ this project versions are for now mere release numbers. They don't have any part
8
8
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
9
9
 
10
10
 
11
+ ## [0.3.0] - 2017-08-17
12
+
13
+ ### Changed
14
+
15
+ - Signature of the `Megaphone::Client` constructor : now takes a host and a port as optional arguments and doesn't take the logger as an argument anymore.
16
+
11
17
  ## [0.2.0] - 2017-08-14
12
18
 
13
19
  ### Changed
data/README.md CHANGED
@@ -13,16 +13,16 @@ Add the gem to your `Gemfile`:
13
13
  ```ruby
14
14
  # Gemfile
15
15
 
16
- gem 'megaphone-client', '~> 0.2.0'
16
+ gem 'megaphone-client', '~> 0.3.0'
17
17
  ```
18
18
 
19
19
  Usage
20
20
  -----
21
- The client will append events to local files unless a `MEGAPHONE_FLUENT_HOST` and `MEGAPHONE_FLUENT_PORT` environment variables are set.
21
+ The client will append events to local files unless the fluentd host and port values are passed as arguments to the client's constructor or the `MEGAPHONE_FLUENT_HOST` and `MEGAPHONE_FLUENT_PORT` environment variables are set.
22
22
 
23
23
  To publish an event on Megaphone
24
24
  ```ruby
25
- event_bus = Megaphone::Client.new({ origin: 'my-awesome-service' })
25
+ event_bus = Megaphone::Client.new({ origin: 'my-awesome-service', host: 'localhost', port: '24224' })
26
26
 
27
27
  topic = :page_changes
28
28
  subtopic = :product_pages
@@ -8,9 +8,10 @@ module Megaphone
8
8
  attr_reader :logger, :origin
9
9
  private :logger, :origin
10
10
 
11
- def initialize(config, logger = Megaphone::Client::Logger.create)
12
- @logger = logger
11
+ def initialize(config)
13
12
  @origin = config.fetch(:origin)
13
+ @logger = Megaphone::Client::Logger.create(config[:host],
14
+ config[:port])
14
15
  end
15
16
 
16
17
  def publish!(topic, subtopic, schema, partition_key, payload)
@@ -4,9 +4,9 @@ require 'megaphone/client/fluent_logger'
4
4
  module Megaphone
5
5
  class Client
6
6
  class Logger
7
- def self.create
8
- fluentd_host = ENV["MEGAPHONE_FLUENT_HOST"]
9
- fluentd_port = ENV["MEGAPHONE_FLUENT_PORT"]
7
+ def self.create(host = nil, port = nil)
8
+ fluentd_host = host || ENV["MEGAPHONE_FLUENT_HOST"]
9
+ fluentd_port = port || ENV["MEGAPHONE_FLUENT_PORT"]
10
10
  if !fluentd_port.nil? && !fluentd_port.empty? &&
11
11
  !fluentd_host.nil? && !fluentd_host.empty?
12
12
  return Megaphone::Client::FluentLogger.new(fluentd_host, fluentd_port)
@@ -1,5 +1,5 @@
1
1
  module Megaphone
2
2
  class Client
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megaphone-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Redbubble
@@ -10,48 +10,48 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-08-14 00:00:00.000000000 Z
13
+ date: 2017-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: fluent-logger
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ~>
19
+ - - "~>"
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.7.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ~>
26
+ - - "~>"
27
27
  - !ruby/object:Gem::Version
28
28
  version: 0.7.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rake
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ~>
33
+ - - "~>"
34
34
  - !ruby/object:Gem::Version
35
35
  version: '10.0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ~>
40
+ - - "~>"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '10.0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '3.0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ~>
54
+ - - "~>"
55
55
  - !ruby/object:Gem::Version
56
56
  version: '3.0'
57
57
  description:
@@ -63,17 +63,17 @@ executables: []
63
63
  extensions: []
64
64
  extra_rdoc_files: []
65
65
  files:
66
+ - CHANGELOG.md
67
+ - LICENSE
68
+ - README.md
66
69
  - doc/redbubble.png
70
+ - lib/megaphone/client.rb
67
71
  - lib/megaphone/client/errors.rb
68
72
  - lib/megaphone/client/event.rb
69
73
  - lib/megaphone/client/file_logger.rb
70
74
  - lib/megaphone/client/fluent_logger.rb
71
75
  - lib/megaphone/client/logger.rb
72
76
  - lib/megaphone/client/version.rb
73
- - lib/megaphone/client.rb
74
- - LICENSE
75
- - README.md
76
- - CHANGELOG.md
77
77
  homepage: https://github.com/redbubble/megaphone-client-ruby
78
78
  licenses:
79
79
  - GPL-3.0
@@ -84,17 +84,17 @@ require_paths:
84
84
  - lib
85
85
  required_ruby_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.0.14.1
97
+ rubygems_version: 2.4.5.1
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Send events to Megaphone.