aws-broker 0.0.9 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bea64a8f73c6d9eeb9ecbd1f7b94dc8cd55c0bac
4
- data.tar.gz: ddd07b9f642366eb3c35613bebbc75cbbeb5ba54
3
+ metadata.gz: 19cdefb5feb597317a3522f00f6e7b7455b2d869
4
+ data.tar.gz: 422c3f690d2cd8a905cb38447fa032e15228825e
5
5
  SHA512:
6
- metadata.gz: 7c79bf52f258b9177f0df06ffda05b1716fc9fd577e47e9d6fcdc89c3d1716c59252b8e9f81d047e0ab0b1a0d749a3801d834ddc568fe9738ffb7432207c07c9
7
- data.tar.gz: 429c62fae26ccdd3bb9cf793881b5e6e04b29f2952207d4e048f55fdfb62a2acb20c9bcdaf97d7f48ab546bf370f5402f1cbb551bc579d439186346f47646ea4
6
+ metadata.gz: da16a81357f08fe560b1b05eb0e04d438cdaa17e1b86653c78fb8d4cd46d7665916206300355e6401040ac36106a2b84063bbc606a66f0014e143e081c6063b0
7
+ data.tar.gz: 93de674cd455119869fe4eb118069ddfd628a93761d65f0ef64913bd47d357a79b21b859a3c7ad7ffb25c13b87a6f009a8bd74c953abb33b49bd9ab60fd8121e
@@ -1,4 +1,5 @@
1
1
  require 'aws/broker/config'
2
+ require 'aws/broker/naming'
2
3
  require 'aws/broker/publisher'
3
4
  require 'aws/broker/subscriber'
4
5
 
@@ -14,6 +15,10 @@ module Aws
14
15
  Subscriber.new(*params).subscribe
15
16
  end
16
17
 
18
+ def naming
19
+ Naming.new
20
+ end
21
+
17
22
  def config
18
23
  @config ||= Broker::Config.new
19
24
  end
@@ -18,11 +18,7 @@ module Aws
18
18
  # lowercase ASCII letters, numbers, underscores, and hyphens, and must
19
19
  # be between 1 and 256 characters long.
20
20
  def topic_name
21
- if config.topic_prefix
22
- "#{config.topic_prefix}_#{@topic}"
23
- else
24
- @topic
25
- end
21
+ naming.topic(@topic)
26
22
  end
27
23
 
28
24
  def sns
@@ -33,6 +29,10 @@ module Aws
33
29
  Broker.config
34
30
  end
35
31
 
32
+ def naming
33
+ Broker.naming
34
+ end
35
+
36
36
  end
37
37
  end
38
38
  end
@@ -0,0 +1,34 @@
1
+ module Aws
2
+ class Broker
3
+ class Naming
4
+
5
+ def queue(topic)
6
+ if config.queue_prefix
7
+ "#{config.queue_prefix}-#{topic(topic)}"
8
+ else
9
+ topic(topic)
10
+ end
11
+ end
12
+
13
+ # http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SNS/Resource.html
14
+ #
15
+ # Constraints: Topic names must be made up of only uppercase and
16
+ # lowercase ASCII letters, numbers, underscores, and hyphens, and must
17
+ # be between 1 and 256 characters long.
18
+ def topic(topic)
19
+ if config.topic_prefix
20
+ "#{config.topic_prefix}_#{topic}"
21
+ else
22
+ topic
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def config
29
+ Broker.config
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -25,11 +25,7 @@ module Aws
25
25
  private
26
26
 
27
27
  def queue_name
28
- if config.queue_prefix
29
- "#{config.queue_prefix}-#{topic_name}"
30
- else
31
- topic_name
32
- end
28
+ naming.queue(@topic)
33
29
  end
34
30
 
35
31
  def create_queue
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eng @ Thanx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2017-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-sns
@@ -50,6 +50,7 @@ files:
50
50
  - lib/aws/broker/base.rb
51
51
  - lib/aws/broker/config.rb
52
52
  - lib/aws/broker/matchers.rb
53
+ - lib/aws/broker/naming.rb
53
54
  - lib/aws/broker/publisher.rb
54
55
  - lib/aws/broker/publishing.rb
55
56
  - lib/aws/broker/railtie.rb