pheme 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d38042f356beb16dc19336d1f8a7103264cd7fc9
4
- data.tar.gz: aea9f789ac089d39c8d3645c31202c6e8d368894
3
+ metadata.gz: 14eae1568c79d666dceae2a6543d089948a9d17d
4
+ data.tar.gz: 4d2122f25924f664b49f2649fec617a9e67ecdf3
5
5
  SHA512:
6
- metadata.gz: '0977af6e8deee4b1a19a69b86f2709055926bd18d925024b41979b292147066019a6a919652fb0063351c1b42278565eecea5986ee9f7f79d98e6f1fd42a292c'
7
- data.tar.gz: 0c0e8351a7cda60992dcf6839b58edc0d87de7f7c5f056187773647a3e2a350423949d2bdbaf3923e4262a18e6bde0ba533297ed221f10c4b0a0cc5d9ecc2dde
6
+ metadata.gz: 1c0ddfea4f7cbbb6ccc3e985a3ef6f644e8f06af24684bf2271b3fc240c0a8390984e8d2d0023be9ba0018297b8bc92fa5c448a1ed11b1484b3f38792b59e4da
7
+ data.tar.gz: a3a5ba835ba6dccd4ca8210e9af6fa89c2f3549889091d74d2b168db80dc0fef3e7d34eb59dccbe4012e49cc4b1565f3e525d1acc610505bc95d32bc39b14c4d
@@ -53,23 +53,30 @@ module Pheme
53
53
  def parse_body(queue_message)
54
54
  message_body = JSON.parse(queue_message.body)
55
55
  raw_content = get_content(message_body)
56
+ body = get_metadata(message_body)
56
57
 
57
58
  case format
58
59
  when :csv
59
60
  parsed_content = parse_csv(raw_content)
61
+ body['Message'] = raw_content
60
62
  when :json
61
63
  parsed_content = parse_json(raw_content)
64
+ body['Message'] = parsed_content
62
65
  else
63
66
  method_name = "parse_#{format}".to_sym
64
67
  raise ArgumentError, "Unknown format #{format}" unless respond_to?(method_name)
65
68
  parsed_content = __send__(method_name, raw_content)
69
+ body['Records'] = parsed_content
66
70
  end
67
71
 
68
- body = format == :csv ? raw_content : parsed_content
69
72
  log_message_received(queue_message, body)
70
73
  parsed_content
71
74
  end
72
75
 
76
+ def get_metadata(message_body)
77
+ message_body.except('Message', 'Records')
78
+ end
79
+
73
80
  def get_content(body)
74
81
  body['Message']
75
82
  end
data/lib/pheme/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pheme
2
- VERSION = "0.0.9".freeze
2
+ VERSION = "0.0.10".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pheme
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
  - Peter Graham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-27 00:00:00.000000000 Z
11
+ date: 2017-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport