imperium 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/imperium.rb +2 -0
- data/lib/imperium/event_fire_response.rb +13 -0
- data/lib/imperium/events.rb +35 -0
- data/lib/imperium/response.rb +1 -1
- data/lib/imperium/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 040c01db1f3d464524d6b66f0b0e52f7c8fc3553
|
4
|
+
data.tar.gz: 65991cbb6b16acce1c2b3d408eaa6ae3e6ec67be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 897ac12a4b8a4616dfe37e3175c69a1ffa3d76d6dff7e7ab0c5beb6370fd39fbb02c32a817dde2e6c87a5fa420c6f5202113e1172fd79821be1d00797cfd062e
|
7
|
+
data.tar.gz: 01d52982aab2dbb960229c7cf2b90b85f577054a894de8c58aa478de1cb0477d7b8038ecc7b573ed94070e02b02cb6f15a0083171785d09d929c0df47bd516a5
|
data/lib/imperium.rb
CHANGED
@@ -3,6 +3,8 @@ require 'imperium/error'
|
|
3
3
|
require 'imperium/configuration'
|
4
4
|
require 'imperium/client'
|
5
5
|
require 'imperium/http_client'
|
6
|
+
require 'imperium/event_fire_response'
|
7
|
+
require 'imperium/events'
|
6
8
|
require 'imperium/kv'
|
7
9
|
require 'imperium/kv_pair'
|
8
10
|
require 'imperium/kv_get_response'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'response'
|
2
|
+
|
3
|
+
module Imperium
|
4
|
+
# EventResponse is a wrapper for the raw HTTP::Message response from the API
|
5
|
+
#
|
6
|
+
# @note This class doesn't really make sense to be instantiated outside of
|
7
|
+
# {Events#fire}
|
8
|
+
class EventFireResponse < Response
|
9
|
+
def id
|
10
|
+
parsed_body['ID']
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Imperium
|
2
|
+
# A client for the Events API.
|
3
|
+
class Events < Client
|
4
|
+
self.path_prefix = 'v1/event'.freeze
|
5
|
+
|
6
|
+
# {#fire fire} an event using the {.default_client}
|
7
|
+
# @see #fire
|
8
|
+
def self.fire(name, payload = nil, dc: nil, node: nil, service: nil, tag: nil)
|
9
|
+
default_client.fire(name, payload, dc: dc, node: node, service: service, tag: tag)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Fire the event
|
13
|
+
#
|
14
|
+
# @example Firing an event with a payload
|
15
|
+
# response = Imperium::Events.fire('foo/bar', 'mypayload') # => EventResponse...
|
16
|
+
#
|
17
|
+
# @param [String] name The name of the event
|
18
|
+
# @param [String] payload Additional data to send as payload of the event
|
19
|
+
# @param [String] dc Specify the datacenter to use for the request
|
20
|
+
# @param [String] node Specifies a regular expression to filter by node name
|
21
|
+
# @param [String] service Specifies a regular expression to filter by service name
|
22
|
+
# @param [String] tag Specifies a regular expression to filter by tag
|
23
|
+
# @return [EventResponse]
|
24
|
+
def fire(name, payload = nil, dc: nil, node: nil, service: nil, tag: nil)
|
25
|
+
query = {}
|
26
|
+
query[:dc] = dc if dc
|
27
|
+
query[:node] = node if node
|
28
|
+
query[:service] = service if service
|
29
|
+
query[:tag] = tag if tag
|
30
|
+
response = @http_client.put(prefix_path("fire/#{name}"),
|
31
|
+
payload, query: query)
|
32
|
+
EventFireResponse.new(response)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/imperium/response.rb
CHANGED
data/lib/imperium/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imperium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Pickett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -160,6 +160,8 @@ files:
|
|
160
160
|
- lib/imperium/client.rb
|
161
161
|
- lib/imperium/configuration.rb
|
162
162
|
- lib/imperium/error.rb
|
163
|
+
- lib/imperium/event_fire_response.rb
|
164
|
+
- lib/imperium/events.rb
|
163
165
|
- lib/imperium/http_client.rb
|
164
166
|
- lib/imperium/kv.rb
|
165
167
|
- lib/imperium/kv_get_response.rb
|