socketry / cloudflare

An asynchronous Ruby wrapper for the CloudFlare V4 API.
MIT License
140 stars 88 forks source link

gem install cloudflare -v 2.0.3 is broken: connection.rb is from version v2.0.2 #14

Closed rafaelfelix closed 7 years ago

rafaelfelix commented 9 years ago

Here's the git diff between the v2.0.2 version and the current HEAD (v2.0.3):

$ git diff v2.0.2..HEAD
diff --git a/lib/cloudflare/connection.rb b/lib/cloudflare/connection.rb
index 6b23229..5ab2dc3 100644
--- a/lib/cloudflare/connection.rb
+++ b/lib/cloudflare/connection.rb
@@ -289,8 +289,9 @@ module CloudFlare
     # @param weight [Intger] (applies to SRV)
     # @param port [Integer] (applies to SRV)
     # @param target [String] (applies to SRV)
+    # @param service_mode [String]

-    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil)
+    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = '1')
       send_req({
         a: :rec_new,
         z: zone,
@@ -305,7 +306,7 @@ module CloudFlare
         weight: weight,
         port: port,
         target: target,
-        service_mode: '1'
+        service_mode: service_mode
       })
     end

@@ -535,7 +536,7 @@ module CloudFlare
       end

       req = Net::HTTP::Post.new(uri.path)
-      req.set_form_data(params)
+      req.set_form_data(params.reject{|k, v| v.nil?})

       http = Net::HTTP.new(uri.host, uri.port)
       http.use_ssl = true
diff --git a/lib/cloudflare/version.rb b/lib/cloudflare/version.rb
index 9248895..6cf4496 100644
--- a/lib/cloudflare/version.rb
+++ b/lib/cloudflare/version.rb
@@ -19,5 +19,5 @@
 # THE SOFTWARE.

 module CloudFlare
-  VERSION = '2.0.2'
+  VERSION = '2.0.3'
 end

And here is lines 291..293 of the connection.rb that actually ships after gem install cloudflare -v 2.0.3:

    # @param target [String] (applies to SRV)

    def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil)
b4k3r commented 8 years ago

Fixed it. https://github.com/b4k3r/cloudflare/releases/tag/v2.1.0

ioquatix commented 7 years ago

Awesome.