Sha256: 5e1b19f081890caa1627232494913425f721e4f09163f2e5e0e46f47ea865d64

Contents?: true

Size: 1.87 KB

Versions: 17

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true

module Files
  class DnsRecord
    attr_reader :options, :attributes

    def initialize(attributes = {}, options = {})
      @attributes = attributes || {}
      @options = options || {}
    end

    # string - Unique label for DNS record; used by Zapier and other integrations.
    def id
      @attributes[:id]
    end

    # string - DNS record domain name
    def domain
      @attributes[:domain]
    end

    # string - DNS record type
    def rrtype
      @attributes[:rrtype]
    end

    # string - DNS record value
    def value
      @attributes[:value]
    end

    # Parameters:
    #   page - int64 - Current page number.
    #   per_page - int64 - Number of records to show per page.  (Max: 10,000, 1,000 or less is recommended).
    #   action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves.
    #   cursor - string - Send cursor to resume an existing list from the point at which you left off.  Get a cursor from an existing list via the X-Files-Cursor-Next header.
    def self.list(params = {}, options = {})
      raise InvalidParameterError.new("Bad parameter: page must be an Integer") if params.dig(:page) and !params.dig(:page).is_a?(Integer)
      raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params.dig(:per_page) and !params.dig(:per_page).is_a?(Integer)
      raise InvalidParameterError.new("Bad parameter: action must be an String") if params.dig(:action) and !params.dig(:action).is_a?(String)
      raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params.dig(:cursor) and !params.dig(:cursor).is_a?(String)

      List.new(DnsRecord, params) do
        Api.send_request("/dns_records", :get, params, options)
      end
    end

    def self.all(params = {}, options = {})
      list(params, options)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
files.com-1.0.121 lib/files.com/models/dns_record.rb
files.com-1.0.120 lib/files.com/models/dns_record.rb
files.com-1.0.119 lib/files.com/models/dns_record.rb
files.com-1.0.118 lib/files.com/models/dns_record.rb
files.com-1.0.117 lib/files.com/models/dns_record.rb
files.com-1.0.116 lib/files.com/models/dns_record.rb
files.com-1.0.115 lib/files.com/models/dns_record.rb
files.com-1.0.114 lib/files.com/models/dns_record.rb
files.com-1.0.113 lib/files.com/models/dns_record.rb
files.com-1.0.112 lib/files.com/models/dns_record.rb
files.com-1.0.111 lib/files.com/models/dns_record.rb
files.com-1.0.110 lib/files.com/models/dns_record.rb
files.com-1.0.109 lib/files.com/models/dns_record.rb
files.com-1.0.108 lib/files.com/models/dns_record.rb
files.com-1.0.107 lib/files.com/models/dns_record.rb
files.com-1.0.106 lib/files.com/models/dns_record.rb
files.com-1.0.105 lib/files.com/models/dns_record.rb