Sha256: 3873cf11b2f376dc7abe9c115c934ba2b1ab27c0f335ab0733632a40f51610d9

Contents?: true

Size: 1020 Bytes

Versions: 7

Compression:

Stored size: 1020 Bytes

Contents

module Dnsimple

  # {Client} backwards compatibility
  module Compatibility
    def self.included(base)
      base.extend ClassMethods
      base.class_eval do
        class << self
          attr_accessor :base_uri, :username, :password, :exchange_token, :api_token, :domain_api_token
        end
      end
    end

    module ClassMethods
      def client
        options = {}
        options[:api_endpoint] = base_uri if base_uri
        options[:username] = username if username
        options[:password] = password if password
        options[:api_token] = api_token if api_token
        options[:domain_api_token] = domain_api_token if domain_api_token
        options[:exchange_token] = exchange_token if exchange_token

        new(options)
      end

      def get(*args)
        client.get(*args)
      end

      def post(*args)
        client.post(*args)
      end

      def put(*args)
        client.put(*args)
      end

      def delete(*args)
        client.delete(*args)
      end
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dnsimple-2.2.0 lib/dnsimple/compatibility.rb
dnsimple-2.1.1 lib/dnsimple/compatibility.rb
dnsimple-2.1.0 lib/dnsimple/compatibility.rb
dnsimple-2.0.0 lib/dnsimple/compatibility.rb
dnsimple-2.0.0.alpha5 lib/dnsimple/compatibility.rb
dnsimple-2.0.0.alpha4 lib/dnsimple/compatibility.rb
dnsimple-2.0.0.alpha3 lib/dnsimple/compatibility.rb