Class: CZDS::ZoneFile

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/czds/zone_file.rb,
lib/czds/zone_file/status.rb

Constant Summary collapse

Status =
Data.define(:file_name, :length, :updated_at) do
  def timestamp
    updated_at.gsub(':', '-')  
  end

  def to_h
    {
      file_name:,
      length:,
      updated_at:,
      timestamp:,
    }
  end
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tld = "com") ⇒ ZoneFile

Returns a new instance of ZoneFile.



14
15
16
17
# File 'lib/czds/zone_file.rb', line 14

def initialize(tld = "com")
  @tld = tld
  @client = Client.new 
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/czds/zone_file.rb', line 10

def client
  @client
end

#tldObject (readonly)

Returns the value of attribute tld.



10
11
12
# File 'lib/czds/zone_file.rb', line 10

def tld
  @tld
end

Instance Method Details

#downloadObject



19
20
21
# File 'lib/czds/zone_file.rb', line 19

def download
  client.download_zone_file(tld)
end

#statusObject



23
24
25
# File 'lib/czds/zone_file.rb', line 23

def status
  @status ||= client.zone_file_status(tld)
end