Class: Freenom::DNSRecordCreator

Inherits:
Explorer
  • Object
show all
Defined in:
lib/freenom/dns/explorers/dns_record_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ExtendedCapybaraDSL

#text?

Methods included from Expecting

#expecting

Constructor Details

#initialize(domain:) ⇒ DNSRecordCreator

Returns a new instance of DNSRecordCreator.



10
11
12
# File 'lib/freenom/dns/explorers/dns_record_creator.rb', line 10

def initialize(domain:)
  @domain = domain
end

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



8
9
10
# File 'lib/freenom/dns/explorers/dns_record_creator.rb', line 8

def domain
  @domain
end

Instance Method Details

#run(name:, type:, time_to_live:, target:) ⇒ Object

Raises:



14
15
16
17
18
19
20
21
22
23
# File 'lib/freenom/dns/explorers/dns_record_creator.rb', line 14

def run(name:, type:, time_to_live:, target:)
  Freenom::DNSRecordsVisitor.new(domain: @domain).run

  fill_in_record_attributes(name, type, time_to_live, target)
  save_record!

  raise RecordCreateError, freenom_error_message if error_occurred?

  true
end