Class: DNSimple::Commands::ListExtendedAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/dnsimple/commands/list_extended_attributes.rb

Instance Method Summary collapse

Instance Method Details

#execute(args, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dnsimple/commands/list_extended_attributes.rb', line 4

def execute(args, options={})
  tld = args.shift
  extended_attributes = ExtendedAttribute.find(tld)
  puts "Extended attributes: "
  extended_attributes.each do |extended_attribute|
    o = "  #{extended_attribute.name}"
    o << " (required)" if extended_attribute.required
    o << " : #{extended_attribute.description}\n"
    unless extended_attribute.options.empty?
      o << "    Options:\n"
      extended_attribute.options.each do |option|
        o << "      #{option.title}: #{option.value}"
        o << " (#{option.description})" if option.description
        o << "\n"
      end
    end
    puts o
  end
end