pechkin 1.0.1 → 1.0.2

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
  SHA256:
3
- metadata.gz: 966f3990124a55de12aa9c9d29af6e1cec929fd316e64db6940bcec3157f5828
4
- data.tar.gz: cc818d878a47c8c7ff816c20e42cdc0a0a02e7046e8955f82290794c6e3179dd
3
+ metadata.gz: c55d33ae23eb9132b6f63595dd39161b0a8f32fe48fa9dc34659b591f94f9da5
4
+ data.tar.gz: 9fd2dd3bf7ea025c853c9230a5d3eb0914f1e6da8ba44c645260ac9547a9dbe4
5
5
  SHA512:
6
- metadata.gz: 9765527f70a1565db8cb5192579b6ba3d6529de6ead792be6825ff8818077ffcef46f67d91e5ac62745553532391a92cfb96c8ee5130681b248e99c55479532b
7
- data.tar.gz: 4a0e8de6ec9c458a895e4df1b26b2a5b89c66d581e4cbd8cdec300bf137a0783838e6c3340f7984f9801913e9e7661c44ab6e87d5954d79d0769111ae618aaaf
6
+ metadata.gz: e9053f20524428bd653c9c03df3cd8c8f2d575a79c5e73b9ebacd97f81f6a02ce6e603bd82e8674b2e72e4d6eae87a872492c67c43a637be710398ac9e122147
7
+ data.tar.gz: 51b92ecafaa72cc5baee024dd154a9dbe85a0675c98864730f7a021c2058d33cc337171e0064fb514c9f11349a5307da828d4a5cc3ecc4dddb80eded1738a357
data/lib/pechkin.rb CHANGED
@@ -62,7 +62,7 @@ module Pechkin # :nodoc:
62
62
  data = read_data(options.data)
63
63
 
64
64
  handler.preview = options.preview
65
- handler.handle(ch, msg, JSON.parse(data, symbolize_names: true))
65
+ handler.handle(ch, msg, JSON.parse(data))
66
66
  end
67
67
 
68
68
  def read_data(data)
data/lib/pechkin/app.rb CHANGED
@@ -70,7 +70,7 @@ module Pechkin
70
70
  return not_found unless message?
71
71
 
72
72
  begin
73
- data = JSON.parse(req.body.read, symbolize_names: true)
73
+ data = JSON.parse(req.body.read)
74
74
  rescue JSON::JSONError => e
75
75
  return bad_request(e.message)
76
76
  end
@@ -94,6 +94,10 @@ module Pechkin
94
94
  response(404, '{"status":"error", "reason":"message not found"}')
95
95
  end
96
96
 
97
+ def bad_request(body)
98
+ response(503, body)
99
+ end
100
+
97
101
  def response(code, body)
98
102
  [code.to_s, DEFAULT_HEADERS, [body]]
99
103
  end
@@ -9,7 +9,7 @@ module Pechkin
9
9
  # Message template to render final message.
10
10
  class MessageTemplate
11
11
  def initialize(erb)
12
- @erb_template = ERB.new(erb, trim_mode: '-')
12
+ @erb_template = ERB.new(erb, nil, trim_mode: '-')
13
13
  end
14
14
 
15
15
  def render(data)
@@ -1,7 +1,7 @@
1
1
  module Pechkin
2
2
  # Keeps actual version
3
3
  module Version
4
- VERSION = [1, 0, 1].freeze
4
+ VERSION = [1, 0, 2].freeze
5
5
  class << self
6
6
  def version_string
7
7
  VERSION.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pechkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Arkhanhelsky