Class: DLDInternet::DOctl::Compute::Domain::Records::Command
- Inherits:
-
Thor::Command
- Object
- Thor::Command
- DLDInternet::DOctl::Compute::Domain::Records::Command
- Defined in:
- lib/dldinternet/doctl/compute/domain/records/command.rb
Instance Method Summary collapse
- #create(domain) ⇒ Object
- #delete(domain, id) ⇒ Object
- #list(domain) ⇒ Object
- #update(domain) ⇒ Object
Instance Method Details
#create(domain) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 36 def create(domain) records_formats command_pre(domain) command_out(DLDInternet::DOctl::API::Compute::Domain::Records::Create.new(, @logger).CreateDomainRecord(domain, )) 0 end |
#delete(domain, id) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 46 def delete(domain, id) # @header = -> { } # @format = ->(o) { o.ai } records_formats command_pre(domain) DLDInternet::DOctl::API::Compute::Domain::Records::Delete.new(, @logger).DeleteDomainRecord(domain, id) command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(, @logger).GetDomainRecordsList(domain)) 0 end |
#list(domain) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 20 def list(domain) records_formats command_pre(domain) command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(, @logger).GetDomainRecordsList(domain)) 0 end |
#update(domain) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/dldinternet/doctl/compute/domain/records/command.rb', line 66 def update(domain) records_formats command_pre(domain) res = DLDInternet::DOctl::API::Compute::Domain::Records::Update.new(, @logger).UpdateDomainRecord(domain, , [:record_id]) if res.is_a?(::DropletKit::DomainRecord) res = DLDInternet::DOctl::API::Compute::Domain::Records::Delete.new(, @logger).DeleteDomainRecord(domain, [:record_id]) if res === true command_out(DLDInternet::DOctl::API::Compute::Domain::Records::List.new(, @logger).GetDomainRecordsList(domain)) 0 else command_out(res) 1 end else command_out(res) 1 end end |