carnivore-http 0.2.4 → 0.2.6

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: 37467796ce245a347449a07231e2f70f6ac07c9b
4
- data.tar.gz: d9a37d58b50449b003bc95c78a1d7e023eacae97
3
+ metadata.gz: f342b9b66f1d52b80f5c7602e176352bea82e607
4
+ data.tar.gz: e42127361c8171ce84eee20e138819053c3a3748
5
5
  SHA512:
6
- metadata.gz: b39823d634cab46702f942faa37ac92e86eaeac025bb4743dc4ee151639d3a158df8fd986b1c0937659231d321b6b0dc771578fe11a226192897d4888fb6d34f
7
- data.tar.gz: cb6e3b2acc5eb175ec4a5c4b023065f90b16567917dee7b497645b33a49a4dc827abb17de5163056b420a959bf6202daf3ffe486acb152c019167caf20cce6aa
6
+ metadata.gz: 19bd3bbc193dd30ed033ad5469c5e6bad34f4e136af8048764ccd92ead069a12863c54f19b46b73a868ca4e2a3a3ee501a320358958380a0c4a1f84db5c80c6a
7
+ data.tar.gz: 763d46d07186e87cb60e5f9603c8489273a3e2746996a405bbeb8d900db30f82a0afd1d48c5d8ade17504584c640f486792fe13bbc308b15cc492ac7a30ce493
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.2.6
2
+ * Add support to disable listen
3
+ * Attempt delivery prior to payload persist
4
+ * Load payload if possible and deliver via :json
5
+
1
6
  # v0.2.4
2
7
  * Add fix for memoization issues on init
3
8
 
@@ -94,7 +94,7 @@ module Carnivore
94
94
 
95
95
  # Always auto start
96
96
  def auto_process?
97
- true
97
+ args.has_key?(:enable_processing) ? args[:enable_processing] : true
98
98
  end
99
99
 
100
100
  # Message is authorized for processing
@@ -234,8 +234,10 @@ module Carnivore
234
234
  # @param headers [Hash] request headers
235
235
  # @return [NilClass]
236
236
  def perform_transmission(message_id, payload, method, url, headers={})
237
- write_for_retry(message_id, payload, method, url, headers)
238
- retry_delivery.async.attempt_redelivery(message_id)
237
+ unless(retry_delivery.redeliver(message_id, payload, method, url, headers))
238
+ write_for_retry(message_id, payload, method, url, headers)
239
+ retry_delivery.async.attempt_redelivery(message_id)
240
+ end
239
241
  nil
240
242
  end
241
243
 
@@ -352,7 +354,14 @@ module Carnivore
352
354
  :password => pass
353
355
  }
354
356
  end
355
- msg
357
+ if(msg[:body].is_a?(Hash) && msg[:body][:id])
358
+ Smash.new(
359
+ :raw => msg,
360
+ :content => msg[:body].to_smash
361
+ )
362
+ else
363
+ msg
364
+ end
356
365
  end
357
366
 
358
367
  end
@@ -68,7 +68,16 @@ module Carnivore
68
68
  if(uri.userinfo)
69
69
  base = base.basic_auth(:user => uri.user, :pass => uri.password)
70
70
  end
71
- result = base.send(method, url, :body => payload)
71
+ if(payload.is_a?(String))
72
+ begin
73
+ payload = MultiJson.load(payload)
74
+ rescue MultiJson::ParseError
75
+ # ignore
76
+ end
77
+ end
78
+ result = base.send(method, url,
79
+ payload.is_a?(Hash) ? :json : :body => payload
80
+ )
72
81
  if(result.code < 200 || result.code > 299)
73
82
  error "Invalid response code received for #{message_id}: #{result.code} - #{result.reason}"
74
83
  false
@@ -1,6 +1,6 @@
1
1
  module Carnivore
2
2
  module Http
3
3
  # current library version
4
- VERSION = Gem::Version.new('0.2.4')
4
+ VERSION = Gem::Version.new('0.2.6')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnivore-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carnivore
@@ -75,7 +75,6 @@ files:
75
75
  - CHANGELOG.md
76
76
  - CONTRIBUTING.md
77
77
  - Gemfile
78
- - Gemfile.lock
79
78
  - LICENSE
80
79
  - README.md
81
80
  - carnivore-http.gemspec
@@ -116,4 +115,3 @@ signing_key:
116
115
  specification_version: 4
117
116
  summary: Message processing helper
118
117
  test_files: []
119
- has_rdoc:
data/Gemfile.lock DELETED
@@ -1,61 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- carnivore-http (0.2.1)
5
- blockenspiel
6
- carnivore (>= 0.1.8)
7
- htauth
8
- reel (~> 0.5.0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- attribute_struct (0.2.8)
14
- blockenspiel (0.4.5)
15
- bogo (0.1.8)
16
- hashie
17
- multi_json
18
- bogo-config (0.1.8)
19
- attribute_struct
20
- bogo (>= 0.1.4, < 1.0)
21
- multi_json
22
- multi_xml
23
- carnivore (0.3.6)
24
- bogo-config
25
- celluloid
26
- hashie
27
- multi_json
28
- celluloid (0.16.0)
29
- timers (~> 4.0.0)
30
- celluloid-io (0.16.2)
31
- celluloid (>= 0.16.0)
32
- nio4r (>= 1.1.0)
33
- form_data (0.1.0)
34
- hashie (3.4.0)
35
- highline (1.7.0)
36
- hitimes (1.2.2)
37
- htauth (1.1.0)
38
- highline (~> 1.6)
39
- http (0.7.1)
40
- form_data (~> 0.1.0)
41
- http_parser.rb (~> 0.6.0)
42
- http_parser.rb (0.6.0)
43
- multi_json (1.10.1)
44
- multi_xml (0.5.5)
45
- nio4r (1.1.0)
46
- reel (0.5.0)
47
- celluloid (>= 0.15.1)
48
- celluloid-io (>= 0.15.0)
49
- http (>= 0.6.0.pre)
50
- http_parser.rb (>= 0.6.0)
51
- websocket_parser (>= 0.1.6)
52
- timers (4.0.1)
53
- hitimes
54
- websocket_parser (1.0.0)
55
-
56
- PLATFORMS
57
- java
58
- ruby
59
-
60
- DEPENDENCIES
61
- carnivore-http!