Module: Porkbun
- Defined in:
- lib/porkbun.rb,
lib/porkbun/version.rb
Defined Under Namespace
Classes: Abstract, DNS, Domain, Error
Constant Summary
collapse
- VERSION =
"0.5.1"
Class Method Summary
collapse
Class Method Details
.ping ⇒ Object
40
41
42
|
# File 'lib/porkbun.rb', line 40
def self.ping
porkbun 'ping'
end
|
.porkbun(path, options = {}) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/porkbun.rb', line 9
def self.porkbun(path, options = {})
if ENV.fetch('PORKBUN_API_KEY', nil).nil? || ENV.fetch('PORKBUN_SECRET_API_KEY', nil).nil?
abort 'PORKBUN_API_KEY and PORKBUN_SECRET_API_KEY must be set'
end
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
|