Class: DNSimple::ExtendedAttribute

Inherits:
Base
  • Object
show all
Defined in:
lib/dnsimple/extended_attribute.rb

Overview

Used for domains that require extended attributes.

Defined Under Namespace

Classes: Option

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from DNSimple::Base

Instance Attribute Details

#descriptionObject

A description of the extended attribute



22
23
24
# File 'lib/dnsimple/extended_attribute.rb', line 22

def description
  @description
end

#nameObject

The extended attribute name



19
20
21
# File 'lib/dnsimple/extended_attribute.rb', line 19

def name
  @name
end

#requiredObject

Boolean indicating if the extended attribute is required



25
26
27
# File 'lib/dnsimple/extended_attribute.rb', line 25

def required
  @required
end

Class Method Details

.find(tld, options = {}) ⇒ Object

Find the extended attributes for the given TLD



40
41
42
43
44
45
46
47
48
49
# File 'lib/dnsimple/extended_attribute.rb', line 40

def self.find(tld, options={})
  response = DNSimple::Client.get("/v1/extended_attributes/#{tld}", options)

  case response.code
  when 200
    response.map { |r| new(r) }
  else
    raise RequestError.new("Error finding extended attributes", response)
  end
end

Instance Method Details

#optionsObject

An array of options for the extended attribute



28
29
30
# File 'lib/dnsimple/extended_attribute.rb', line 28

def options
  @options ||= []
end

#options=(opts) ⇒ Object



32
33
34
35
36
37
# File 'lib/dnsimple/extended_attribute.rb', line 32

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