hub_client 0.0.2 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjZkNGYyZjVkYThhMjllMTY3NDA5MWMyNjNjYjU2ZjU5OTUyMzg1OA==
4
+ OWRlZmRiZDgzOGU1NDM4MGQ0ZDM4NjBkYzhkNWMzMWVhMTFhNzI3Ng==
5
5
  data.tar.gz: !binary |-
6
- ZjUwZjUyYTVkZWVhZmRlODI4MjU4Y2Y3NjZiMjUxNzQwZWU0NTRlZA==
6
+ MzQzNzU4NTZjNDZjNTc2ZjQ1YTJiNGQzYzAwZjQ3MDZhZjFjOWFhMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Y2MxOWZiMGMxMGE2NWNmY2Q4NjU1ZjkwN2RmNTliZGRjYTliZDk0YTg2OGNi
10
- NjUxNjQzN2JlNTdmYmUwMDBmMTM1NjhhZjNkNWI5YzFmNmY2NDk0YTg5ODdk
11
- YjkyNDFkZDgwZmRiYTQ0MjM3NjFlNDA0NmEwNmY4NmFlMDc2ZjY=
9
+ MzM4NTU1ODhlOTFkOWU2NTQ0OGU4ZDA3MTUzMDdhYzk3ZWM4ZjhlMjJiOTFm
10
+ NTU1Y2Q0NzVmN2VlM2UwMzc4NTQ4MzI4ODc2ODQ2ZDJhNmFhZWY4ZDcwZWFk
11
+ NGRjNWU1NjM0Yjg0YTJlMjFmMDBhYTU2MTZmOWI4MTRmNTVjNjc=
12
12
  data.tar.gz: !binary |-
13
- ZDE3NThkM2M5OTkzNTk3NWNiZGUwZDE5YzNlNTgwMjdmOGMxMTMyNjdmNjMx
14
- MWI4OTFjMDhhM2EzMTIwZGI1MDgwYjA4ZjE3YjE4MzNhMWRhOGI4MWRlZDA1
15
- Y2JiZDk2NmUzZjJlYWFlOGY4ODdlNDY1ZGZjNTgwMDIwNzcyZjk=
13
+ MGI3NzNiNGU2OWJkYWQ1MzQ5NjMwZTE4N2NlYjI1NWVmOGRkNzUxZWUzY2Mx
14
+ NzhmOTM4N2VlNGY0ZjBlMDNkMDAyZTM4NTM4NGEzY2EwNjlkY2Q1YWI3N2I0
15
+ NGU4NzVlODIwNDJmNDNhZDMxZTZiMTBiN2M2NWExMzNhM2RiZWE=
@@ -1,3 +1,3 @@
1
1
  module HubClient
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/hub_client.rb CHANGED
@@ -8,13 +8,9 @@ module HubClient
8
8
  raise ConfigArgumentMissing, "endpoint_url missing" unless HubClient.configuration.endpoint_url
9
9
  raise ConfigArgumentMissing, "env missing" unless HubClient.configuration.env
10
10
 
11
- if HubClient.configuration.http_auth.present?
12
- opts = HubClient.configuration.http_auth.slice(:user, :password)
13
- end
11
+ payload = { type: type, env: HubClient.configuration.env, content: content.to_json }
14
12
 
15
- rest_resource = RestClient::Resource.new(HubClient.configuration.endpoint_url, opts)
16
- payload = { type: type, env: HubClient.configuration.env, content: content }
17
- rest_resource.post(payload) do |response, request, result|
13
+ RestClient.post(HubClient.configuration.endpoint_url, payload, content_type: :json) do |response, request, result|
18
14
  handle_response(response, request, result)
19
15
  end
20
16
  end
@@ -27,7 +27,7 @@ describe HubClient do
27
27
 
28
28
  it "publishes a message to hub" do
29
29
  stub_request(:post, HubClient.configuration.endpoint_url).
30
- with(body: { env: "il-qa2", type: "order_created", content: { some: "content" } }).
30
+ with(body: { env: "il-qa2", type: "order_created", content: { some: "content" }.to_json }).
31
31
  to_return(status: 204)
32
32
 
33
33
  HubClient.publish(:order_created, { some: "content" })
@@ -36,7 +36,7 @@ describe HubClient do
36
36
 
37
37
  it "logs the request when hub didn't return success code" do
38
38
  stub_request(:post, HubClient.configuration.endpoint_url).
39
- with(body: { env: "il-qa2", type: "order_created", content: { some: "content" } }).
39
+ with(body: { env: "il-qa2", type: "order_created", content: { some: "content" }.to_json }).
40
40
  to_return(status: 500)
41
41
 
42
42
  expect(HubClient.logger).to receive(:info)
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.2
4
+ version: 0.0.4
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-01 00:00:00.000000000 Z
11
+ date: 2014-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client