Module: Porkbun

Defined in:
lib/porkbun.rb,
lib/porkbun/version.rb

Defined Under Namespace

Classes: Abstract, DNS, Domain, Error

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.pingObject



37
38
39
# File 'lib/porkbun.rb', line 37

def self.ping
  porkbun 'ping'
end

.porkbun(path, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/porkbun.rb', line 9

def self.porkbun(path, options = {})
  res = HTTP.post File.join('https://porkbun.com/api/json/v3', path), json: {
    secretapikey: ENV.fetch('PORKBUN_SECRET_API_KEY', nil),
    apikey: ENV.fetch('PORKBUN_API_KEY', nil)
  }.merge(options)

  JSON.parse(res.body, symbolize_names: true)
end