class CloudFlare::DynamicDNS::Runner

Main coordinator of the dynamic dns gem which fetches configuration from disk and current ip and invokes the cloudflare updater to change config via API.

Attributes

path[R]

Public Class Methods

new(path: nil) click to toggle source

@param [String] path

# File lib/cloud_flare/dynamic_dns/runner.rb, line 11
def initialize(path: nil)
  @path = path
end

Public Instance Methods

execute() click to toggle source

Update IP in cloudflare.

# File lib/cloud_flare/dynamic_dns/runner.rb, line 16
def execute
  data = ConfigReader.new(path: path).read
  config = ConfigParser.new(data: data).execute

  ip = IfConfig.new.execute

  Updater.new(
    key: config['key'],
    email: config['email'],
    zone: config['zone'],
    hostname: config['hostname'],
    ipv4: ip
  ).update
end