gibbon 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gibbon might be problematic. Click here for more details.
- data/gibbon.gemspec +1 -1
- data/lib/gibbon.rb +3 -7
- data/test/test_gibbon.rb +1 -1
- metadata +4 -4
data/gibbon.gemspec
CHANGED
data/lib/gibbon.rb
CHANGED
@@ -6,7 +6,6 @@ class Gibbon
|
|
6
6
|
include HTTParty
|
7
7
|
format :plain
|
8
8
|
default_timeout 30
|
9
|
-
disable_rails_query_string_format
|
10
9
|
|
11
10
|
attr_accessor :api_key, :timeout, :throws_exceptions
|
12
11
|
|
@@ -14,6 +13,7 @@ class Gibbon
|
|
14
13
|
|
15
14
|
def initialize(api_key = nil, default_parameters = {})
|
16
15
|
@api_key = api_key || self.class.api_key || ENV['MAILCHIMP_API_KEY']
|
16
|
+
@api_key = @api_key.strip if @api_key
|
17
17
|
|
18
18
|
@timeout = default_parameters.delete(:timeout)
|
19
19
|
@throws_exceptions = default_parameters.delete(:throws_exceptions)
|
@@ -24,7 +24,7 @@ class Gibbon
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def api_key=(value)
|
27
|
-
@api_key = value
|
27
|
+
@api_key = value.strip if value
|
28
28
|
@default_params = @default_params.merge({apikey: @api_key})
|
29
29
|
end
|
30
30
|
|
@@ -34,10 +34,6 @@ class Gibbon
|
|
34
34
|
|
35
35
|
protected
|
36
36
|
|
37
|
-
def base_api_url
|
38
|
-
"https://#{dc_from_api_key}api.mailchimp.com/1.3/?method="
|
39
|
-
end
|
40
|
-
|
41
37
|
def call(method, params = {})
|
42
38
|
api_url = base_api_url + method
|
43
39
|
params = @default_params.merge(params)
|
@@ -120,7 +116,7 @@ class GibbonExport < Gibbon
|
|
120
116
|
def call(method, params = {})
|
121
117
|
api_url = export_api_url + method + "/"
|
122
118
|
params = @default_params.merge(params)
|
123
|
-
response = self.class.post(api_url, body: params, timeout: @timeout)
|
119
|
+
response = self.class.post(api_url, body: CGI::escape(params.to_json), timeout: @timeout)
|
124
120
|
|
125
121
|
lines = response.body.lines
|
126
122
|
if @throws_exceptions
|
data/test/test_gibbon.rb
CHANGED
@@ -178,7 +178,7 @@ class TestGibbon < Test::Unit::TestCase
|
|
178
178
|
@api_key = "TESTKEY-us2"
|
179
179
|
@gibbon = GibbonExport.new(@api_key)
|
180
180
|
|
181
|
-
params = {:body => @body, :timeout => 30}
|
181
|
+
params = {:body => CGI::escape(@body.to_json), :timeout => 30}
|
182
182
|
|
183
183
|
url = @url.gsub('us1', 'us2') + "sayHello/"
|
184
184
|
GibbonExport.expects(:post).with(url, params).returns(@returns)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gibbon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash: -
|
146
|
+
hash: -3179845678375072173
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
version: '0'
|
153
153
|
segments:
|
154
154
|
- 0
|
155
|
-
hash: -
|
155
|
+
hash: -3179845678375072173
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project: gibbon
|
158
158
|
rubygems_version: 1.8.24
|