Sha256: a12bfc9705d980587cbab13852ea42b7a0d21997b5c207529bdb43bf44ae63c6

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

class DNSimple::ExtendedAttribute < DNSimple::Base # Used for domains that require extended attributes.
  # An option for an extended attribute
  class Option < DNSimple::Base
    # The option name
    attr_accessor :title

    # The option value
    attr_accessor :value

    # A long description of the option
    attr_accessor :description
  end

  # The extended attribute name
  attr_accessor :name

  # A description of the extended attribute
  attr_accessor :description

  # Boolean indicating if the extended attribute is required
  attr_accessor :required

  # An array of options for the extended attribute
  def options
    @options ||= []
  end

  def options=(opts)
    @options = []
    opts.each do |opt|
      @options << DNSimple::ExtendedAttribute::Option.new(opt)
    end
  end

  # Find the extended attributes for the given TLD
  def self.find(tld, options={})
    response = DNSimple::Client.get "extended_attributes/#{tld}.json", options

    case response.code
    when 200
      response.map { |r| new(r) }
    else
      raise RuntimeError, "Error: #{response.code}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dnsimple-ruby-1.3.2 lib/dnsimple/extended_attribute.rb
dnsimple-ruby-1.3.1 lib/dnsimple/extended_attribute.rb
dnsimple-ruby-1.3.0 lib/dnsimple/extended_attribute.rb