Sha256: 3b54669cabfa3277e8df115092c095ad0c7a6d49fff6d4a348d4794a33e53d8d

Contents?: true

Size: 636 Bytes

Versions: 10

Compression:

Stored size: 636 Bytes

Contents

module DNSimple
  module Commands
    class ContactUpdate
      # Execute the contact:update command.
      #
      # Args expected:
      # id [name:value name:value ...]
      def execute(args, options = {})
        attributes = {}
        id = args.shift
        args.each do |arg|
          name, value = arg.split(":")
          attributes[Contact.resolve(name)] = value
        end 

        contact = Contact.find(id)
        attributes.each do |name, value|
          contact.send("#{name}=", value)
        end
        contact.save
        puts "Updated contact #{contact.name} (id: #{contact.id})"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dnsimple-ruby-1.7.1 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.7.0 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.6.0 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.5.5 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.5.4 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.5.3 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.5.2 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.5.1 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.4.1 lib/dnsimple/commands/contact_update.rb
dnsimple-ruby-1.4.0 lib/dnsimple/commands/contact_update.rb