megaphone-client 0.1.3 → 0.2.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: d232340c531e88861d6ee9e1ac4f9b1feaa29ef7
4
- data.tar.gz: 5b8ac02a402a71b31c853ba21e0d8689a0dd04d8
3
+ metadata.gz: 898f4838e1b445a91974f65ffad3f32e65231eae
4
+ data.tar.gz: 460c69341742e3e7173034ec05b1dacb91cc6206
5
5
  SHA512:
6
- metadata.gz: d1e2cba07aad8ef8100fdcea606b13e7877d6aa6a3254d5b1ed59e7ea71c4af7f5bbc2d18dba2a9189e46593a87d485ca813bdfb734826522f9c1d8732641e2d
7
- data.tar.gz: 4d40e91a5da7cef1961d19e8c52915ef3a834a710790be274e478eec7fffe3015e4c9d39680f623d918307fbb8725bf154126bbec4a013c2aef8e7cdeb8aef67
6
+ metadata.gz: 11d54f2d08d3f27fa16c66e5a3ebca2a9dfe4931aa0ee5e0af56c0ec234703078e9d362a6cb7d3c7a4a7a4ebbf1aac55152d66fc2dc8702f6b71088b719e0e3f
7
+ data.tar.gz: b77d97d955b444e681cea5007efb1b2545000dff7541b4a57fee02fef7c083ea19bd8930009043f1a54ade07ec0ac9cc73c44d869e55468ffbaa8dfc4e15adac
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.2.0] - 2017-08-14
12
+
13
+ ### Changed
14
+
15
+ - Signature of the `publish!` method: now takes a schema and a partition key as arguments
16
+
11
17
  ## [0.1.2] - 2017-08-04
12
18
 
13
19
  ### Fixed
data/README.md CHANGED
@@ -13,7 +13,7 @@ Add the gem to your `Gemfile`:
13
13
  ```ruby
14
14
  # Gemfile
15
15
 
16
- gem 'megaphone-client', '~> 0.1.0'
16
+ gem 'megaphone-client', '~> 0.2.0'
17
17
  ```
18
18
 
19
19
  Usage
@@ -26,9 +26,11 @@ event_bus = Megaphone::Client.new({ origin: 'my-awesome-service' })
26
26
 
27
27
  topic = :page_changes
28
28
  subtopic = :product_pages
29
+ schema = 'http://www.github.com/redbuble/megaphone-event-type-registry/topics/cats'
30
+ partition_key = '1357924680'
29
31
  payload = { url: 'https://www.redbubble.com/people/wytrab8/works/26039653-toadally-rad?grid_pos=1&p=mens-graphic-t-shirt&rbs=29c497ad-a976-42b8-aa40-0e218903c558&ref=shop_grid&style=mens' }
30
32
 
31
- event_bus.publish!(topic, subtopic, payload)
33
+ event_bus.publish!(topic, subtopic, schema, partition_key, payload)
32
34
  ```
33
35
 
34
36
  Credits
@@ -13,8 +13,8 @@ module Megaphone
13
13
  @origin = config.fetch(:origin)
14
14
  end
15
15
 
16
- def publish!(topic, subtopic, payload)
17
- event = Event.new(topic, subtopic, origin, payload)
16
+ def publish!(topic, subtopic, schema, partition_key, payload)
17
+ event = Event.new(topic, subtopic, origin, schema, partition_key, payload)
18
18
  unless logger.post(topic, event.to_hash)
19
19
  raise MegaphoneUnavailableError.new(logger.last_error.message, event)
20
20
  end
@@ -3,19 +3,25 @@ require 'json'
3
3
  module Megaphone
4
4
  class Client
5
5
  class Event
6
- def initialize(topic, subtopic, origin, payload)
6
+ def initialize(topic, subtopic, origin, schema, partition_key, payload)
7
7
  @topic = topic
8
8
  @subtopic = subtopic
9
9
  @origin = origin
10
+ @schema = schema
11
+ @partition_key = partition_key
10
12
  @payload = payload
11
13
  end
12
14
 
13
15
  def to_hash
14
16
  {
15
- topic: @topic,
16
- subtopic: @subtopic,
17
- origin: @origin,
18
- payload: @payload
17
+ meta: {
18
+ schema: @schema,
19
+ origin: @origin,
20
+ topic: @topic,
21
+ subtopic: @subtopic,
22
+ partitionKey: @partition_key
23
+ },
24
+ data: @payload
19
25
  }
20
26
  end
21
27
 
@@ -1,5 +1,5 @@
1
1
  module Megaphone
2
2
  class Client
3
- VERSION = "0.1.3"
3
+ VERSION = "0.2.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.1.3
4
+ version: 0.2.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-09 00:00:00.000000000 Z
13
+ date: 2017-08-14 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
69
66
  - doc/redbubble.png
70
- - lib/megaphone/client.rb
71
67
  - lib/megaphone/client/errors.rb
72
68
  - lib/megaphone/client/event.rb
73
69
  - lib/megaphone/client/file_logger.rb
74
70
  - lib/megaphone/client/fluent_logger.rb
75
71
  - lib/megaphone/client/logger.rb
76
72
  - 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.4.5.1
97
+ rubygems_version: 2.0.14.1
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Send events to Megaphone.