hub_client 0.0.6 → 0.0.7
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 +8 -8
- data/lib/hub_client.rb +3 -1
- data/lib/hub_client/version.rb +1 -1
- data/spec/hub_client_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2Y3MzE3NTY1NWFjZWQyMzZhNTExYmIzOGNlYjk0NmIxNThmYzA3Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGVjYTc1YjEyZDM4MmY2YWNhZjg0NjNiZDcwNmU2ZjBkZDc3NmU2Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTBkYmQzNmY4YzE2MjQ4MDQzZjk0OGQ3MDZhMjc4Mzc3N2RmYjAzZGQ2M2Ri
|
10
|
+
ZDQ2MzNiODZkNTc5ZWYxMzBhN2ZlNDgwMTc4MTY4Mjg5MTNlYmYxMTIyODli
|
11
|
+
MzljN2QwZGE3NGM1MzFlNTg1YzdmMzk1NGRlMjc0YjVjODExMzM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGM3YjljOTI1M2U2NTViYmM4YzBmYWI4MTMzMDNlYmQ1OTJiZTMwOTVkYWU4
|
14
|
+
OGEwZTg2MTg3ZTdmNTRkMjA4NDc0MjA2ODYzMmI1ZjFiMDRiNzlmMmVlYTIx
|
15
|
+
NjQzZTg1NWI5OTE3NDI2ZWQwODkzYzRjNTE1NDdiYzQ5YTgyYWE=
|
data/lib/hub_client.rb
CHANGED
@@ -4,11 +4,13 @@ require "hub_client/version"
|
|
4
4
|
require "rest-client"
|
5
5
|
|
6
6
|
module HubClient
|
7
|
-
def self.publish(type, content)
|
7
|
+
def self.publish(type, content, env = nil)
|
8
8
|
raise ConfigArgumentMissing, "endpoint_url missing" unless HubClient.configuration.endpoint_url
|
9
9
|
|
10
10
|
payload = { type: type, content: content.to_json }
|
11
11
|
payload[:env] = HubClient.configuration.env if HubClient.configuration.env
|
12
|
+
payload[:env] = env if env
|
13
|
+
|
12
14
|
hub_url = build_hub_url(HubClient.configuration.endpoint_url)
|
13
15
|
|
14
16
|
RestClient.post(hub_url, payload, content_type: :json) do |response, request, result|
|
data/lib/hub_client/version.rb
CHANGED
data/spec/hub_client_spec.rb
CHANGED
@@ -39,6 +39,15 @@ describe HubClient do
|
|
39
39
|
assert_requested :post, HubClient.build_hub_url(HubClient.configuration.endpoint_url)
|
40
40
|
end
|
41
41
|
|
42
|
+
it "overrides the env when supplied" do
|
43
|
+
stub_request(:post, HubClient.build_hub_url(HubClient.configuration.endpoint_url)).
|
44
|
+
with(body: { env: "batman-env", type: "order_created", content: { some: "content" }.to_json }).
|
45
|
+
to_return(status: 204)
|
46
|
+
|
47
|
+
HubClient.publish(:order_created, { some: "content" }, "batman-env")
|
48
|
+
assert_requested :post, HubClient.build_hub_url(HubClient.configuration.endpoint_url)
|
49
|
+
end
|
50
|
+
|
42
51
|
after(:all) { HubClient.reset_configuration }
|
43
52
|
end
|
44
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hub_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yarin Goldman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|