class Robtex::CLI

Public Instance Methods

api() click to toggle source
# File lib/robtex/cli.rb, line 38
def api
  API.new
end
as(query) click to toggle source
# File lib/robtex/cli.rb, line 14
def as(query)
  with_error_handling do
    res = api.as(query)
    puts JSON.pretty_generate(res)
  end
end
fpdns(query) click to toggle source
# File lib/robtex/cli.rb, line 30
def fpdns(query)
  with_error_handling do
    res = api.fpdns(query)
    puts JSON.pretty_generate(res)
  end
end
ip(query) click to toggle source
# File lib/robtex/cli.rb, line 6
def ip(query)
  with_error_handling do
    res = api.ip(query)
    puts JSON.pretty_generate(res)
  end
end
rpdns(query) click to toggle source
# File lib/robtex/cli.rb, line 22
def rpdns(query)
  with_error_handling do
    res = api.rpdns(query)
    puts JSON.pretty_generate(res)
  end
end
with_error_handling() { || ... } click to toggle source
# File lib/robtex/cli.rb, line 42
def with_error_handling
  yield
rescue ResponseError => e
  puts "Warning: #{e}"
end