ihunter-whatcounts 0.3.5 → 0.3.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.
data/lib/whatcounts.rb CHANGED
@@ -6,7 +6,7 @@ require 'cgi'
6
6
  # require 'fastercsv'
7
7
 
8
8
  module WhatCounts
9
- VERSION = '0.3.5'
9
+ VERSION = '0.3.6'
10
10
  class WhatCountsError < StandardError; end
11
11
 
12
12
  class CreationError < WhatCountsError; end
@@ -28,7 +28,8 @@ module WhatCounts
28
28
  raise InvalidConfiguration,"Invalid WhatCounts configuration, are you sure it was configured?" unless @config
29
29
  url = [@config.api_url,"?","c=#{command}&",@config.to_param_string,"&",requestable.to_param_string].join
30
30
  res = Curl::Easy.perform(url) do |easy|
31
- easy.timeout = 8
31
+ easy.connect_timeout = 10
32
+ easy.timeout = 30
32
33
  end
33
34
  WhatCounts::Response.new(url,res.body_str)
34
35
  end
@@ -39,13 +39,16 @@ module WhatCounts
39
39
  if self.data.kind_of? String
40
40
  pairs << "data=#{CGI.escape(self.data)}"
41
41
  elsif self.data.kind_of? Hash
42
- data_pairs = self.data.inject([[],[]]){|acc,(k,v)| acc[0]<<k;acc[1]<<v;acc}
43
- data_field = "#{data_pairs[0].join(',')}^#{data_pairs[1].join(',')}"
44
- pairs << "data=#{CGI.escape(data_field)}"
42
+ data_pairs = self.data.inject([[],[]]) do |acc,(k,v)|
43
+ acc[0] << CGI.escape(k)
44
+ acc[1] << CGI.escape(v)
45
+ acc
46
+ end
47
+ pairs << "data=#{data_pairs[0].join(',')}^#{data_pairs[1].join(',')}"
45
48
  else
46
49
  # TODO i duno what to do here, probably error? Maybe not since the param isn't required
47
50
  end
48
- end
51
+ end
49
52
  pairs
50
53
  end.join("&")
51
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ihunter-whatcounts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Hunter
@@ -50,6 +50,7 @@ files:
50
50
  - lib/whatcounts/rails/mailer.rb
51
51
  has_rdoc: false
52
52
  homepage: http://github.com/ihunter/whatcounts
53
+ licenses:
53
54
  post_install_message: PostInstall.txt
54
55
  rdoc_options:
55
56
  - --main
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  requirements: []
72
73
 
73
74
  rubyforge_project: whatcounts
74
- rubygems_version: 1.2.0
75
+ rubygems_version: 1.3.5
75
76
  signing_key:
76
77
  specification_version: 3
77
78
  summary: WhatCounts HTTP API interface