active_campaign 0.1.4 → 0.1.5

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: 8398a60d8813e841f5afa215ffeb6066a4ff395d
4
- data.tar.gz: afa4838934daf586899e694c9713a891c240d937
3
+ metadata.gz: 104df53715ce913f6d497ae4fe571eefe26e840e
4
+ data.tar.gz: 6f0977e741a5147e473280012d2e34de5829283d
5
5
  SHA512:
6
- metadata.gz: 82e27167097b9400cc7ef1b8af42b6dc21b674ab53789a1a9d65903d74ef7e058e156834bb8b14d8e6712312eeff0c0ddbb89a4384eb3bc227d74774862c2622
7
- data.tar.gz: 34b35346dac58e002fcc86e882cd1edccab5b92375b8efaa457ec11f11e89bca187603f57ad3de17acb9d771554a054483caa978a804af3c8002fef9db670082
6
+ metadata.gz: 531e1b7629b4e1a891f6e1c6042c919745f5a2e05cbc305218c78db0fb40a5841b4bfd1197911aea2d7d9ea34a1fb6c08d0e837973a4494c98a7ad40068f4978
7
+ data.tar.gz: 890848b6df5847cf90f196514aefde062e70fd3334b1433e7981c4324fe5b201d5551827ea4e9a3afeed23f72909dafa050cdfc29ffe30348ce5491060784509
@@ -60,7 +60,7 @@ module ActiveCampaign
60
60
  request = HTTPI::Request.new :url => File.join(api_endpoint, api_path)
61
61
  request.headers = {"User-Agent" => user_agent}
62
62
  request.query = query(method, api_method, options)
63
- request.body = options.to_query if method == :post
63
+ request.body = body(method, api_method, options)
64
64
 
65
65
  request
66
66
  end
@@ -80,6 +80,17 @@ module ActiveCampaign
80
80
  q
81
81
  end
82
82
 
83
+ def body(method, api_method, options = {})
84
+ return nil unless method == :post
85
+
86
+ fields = options.delete(:fields){ Hash.new }
87
+ options[:field] = fields.inject({}) do |hash, (k,v)|
88
+ hash.merge("%#{k}%,0" => v)
89
+ end
90
+
91
+ options.to_query
92
+ end
93
+
83
94
  def normalize(response)
84
95
  keys, values = keys_values(response)
85
96
 
@@ -1,3 +1,3 @@
1
1
  module ActiveCampaign
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson