Class: DNSimple::ExtendedAttribute
- Inherits:
-
Object
- Object
- DNSimple::ExtendedAttribute
- Includes:
- HTTParty
- Defined in:
- lib/dnsimple/extended_attribute.rb
Overview
Used for domains that require extended attributes.
Defined Under Namespace
Classes: Option
Instance Attribute Summary collapse
-
#description ⇒ Object
A description of the extended attribute.
-
#name ⇒ Object
The extended attribute name.
-
#required ⇒ Object
Boolean indicating if the extended attribute is required.
Class Method Summary collapse
-
.find(tld, options = {}) ⇒ Object
Find the extended attributes for the given TLD.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ ExtendedAttribute
constructor
:nodoc:.
-
#options ⇒ Object
An array of options for the extended attribute.
- #options=(opts) ⇒ Object
Constructor Details
#initialize(attributes) ⇒ ExtendedAttribute
:nodoc:
36 37 38 39 40 41 |
# File 'lib/dnsimple/extended_attribute.rb', line 36 def initialize(attributes) attributes.each do |key, value| m = "#{key}=".to_sym self.send(m, value) if self.respond_to?(m) end end |
Instance Attribute Details
#description ⇒ Object
A description of the extended attribute
30 31 32 |
# File 'lib/dnsimple/extended_attribute.rb', line 30 def description @description end |
#name ⇒ Object
The extended attribute name
27 28 29 |
# File 'lib/dnsimple/extended_attribute.rb', line 27 def name @name end |
#required ⇒ Object
Boolean indicating if the extended attribute is required
33 34 35 |
# File 'lib/dnsimple/extended_attribute.rb', line 33 def required @required end |
Class Method Details
.find(tld, options = {}) ⇒ Object
Find the extended attributes for the given TLD
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/dnsimple/extended_attribute.rb', line 56 def self.find(tld, ={}) .merge!({:basic_auth => Client.credentials}) response = self.get("#{Client.base_uri}/extended_attributes/#{tld}.json", ) pp response if Client.debug? case response.code when 200 response.map { |r| ExtendedAttribute.new(r) } when 401 raise RuntimeError, "Authentication failed" else raise RuntimeError, "Error: #{response.code}" end end |
Instance Method Details
#options ⇒ Object
An array of options for the extended attribute
44 45 46 |
# File 'lib/dnsimple/extended_attribute.rb', line 44 def @options ||= [] end |