Sha256: 9fe5669d44a7d271a1f96ba99d33d00d40aa8281916e23b62d53ca95c9f27268

Contents?: true

Size: 1.13 KB

Versions: 19

Compression:

Stored size: 1.13 KB

Contents

require 'ns1'

module RecordStore
  class Provider::NS1 < Provider
    class Error < StandardError; end

    class Client < ::NS1::Client
      def initialize(api_key:)
        super(api_key)
      end

      def zones
        super
      end

      def zone(name)
        super(name)
      end

      def record(zone:, fqdn:, type:, must_exist: false)
        result = super(zone, fqdn, type)
        raise(Error, result.to_s) if must_exist && result.is_a?(NS1::Response::Error)
        return nil if result.is_a?(NS1::Response::Error)
        result
      end

      def create_record(zone:, fqdn:, type:, params:)
        result = super(zone, fqdn, type, params)
        raise(Error, result.to_s) if result.is_a?(NS1::Response::Error)
        nil
      end

      def modify_record(zone:, fqdn:, type:, params:)
        result = super(zone, fqdn, type, params)
        raise(Error, result.to_s) if result.is_a?(NS1::Response::Error)
        nil
      end

      def delete_record(zone:, fqdn:, type:)
        result = super(zone, fqdn, type)
        raise(Error, result.to_s) if result.is_a?(NS1::Response::Error)
        nil
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
record_store-6.3.0 lib/record_store/provider/ns1/client.rb
record_store-6.2.1 lib/record_store/provider/ns1/client.rb
record_store-6.2.0 lib/record_store/provider/ns1/client.rb
record_store-6.1.2 lib/record_store/provider/ns1/client.rb
record_store-6.1.1 lib/record_store/provider/ns1/client.rb
record_store-6.1.0 lib/record_store/provider/ns1/client.rb
record_store-6.0.1 lib/record_store/provider/ns1/client.rb
record_store-6.0.0 lib/record_store/provider/ns1/client.rb
record_store-5.11.0 lib/record_store/provider/ns1/client.rb
record_store-5.10.0 lib/record_store/provider/ns1/client.rb
record_store-5.9.0 lib/record_store/provider/ns1/client.rb
record_store-5.8.0 lib/record_store/provider/ns1/client.rb
record_store-5.7.4 lib/record_store/provider/ns1/client.rb
record_store-5.7.3 lib/record_store/provider/ns1/client.rb
record_store-5.7.2 lib/record_store/provider/ns1/client.rb
record_store-5.7.1 lib/record_store/provider/ns1/client.rb
record_store-5.7.0 lib/record_store/provider/ns1/client.rb
record_store-5.6.0 lib/record_store/provider/ns1/client.rb
record_store-5.5.4 lib/record_store/provider/ns1/client.rb