logbook 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -42,8 +42,21 @@ class Logbook::Client
42
42
 
43
43
  def request_body(entries)
44
44
  hash = Addressable::URI.new
45
- processed = entries.map { |entry| entry.inject({}) { |r, e| r[e.first] = e.last.to_s; r } }
45
+ processed = entries.map do |entry|
46
+ entry.inject({}) do |result, el|
47
+ result[el.first] = if el.last.is_a?(Hash)
48
+ el.last.inject({}) { |r, e| r[e.first] = e.last.to_s; r }
49
+ else
50
+ el.last.to_s
51
+ end
52
+ result
53
+ end
54
+ end
46
55
  hash.query_values = {:entries => processed, :api_key => @api_key}
47
56
  hash.query
48
57
  end
58
+
59
+ def hash_values_to_string(h)
60
+ h.inject({}) { |r, e| r[e.first] = e.last.to_s; r }
61
+ end
49
62
  end
@@ -1,3 +1,3 @@
1
1
  module Logbook
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -32,6 +32,11 @@ describe Logbook::Client do
32
32
  to_not raise_error
33
33
  end
34
34
 
35
+ it 'should convert payload hash values to strings' do
36
+ subject.send_entries([{:payload => { :foo => 'bar' }}])
37
+ request.body.should include("entries[0][payload][foo]=bar")
38
+ end
39
+
35
40
  it "should send api_key in the request" do
36
41
  subject.send_entries([])
37
42
  request.body.should include("api_key=key")
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logbook
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - 48 hours of unpaid work and 5 cookies Rails Rumble 2010 Team