PorkbunRB
PorkbunRB is a Ruby library for the Porkbun API.
Installation
Add this line to your application's Gemfile:
gem "porkbunrb"
Usage
Set Client Details
Firstly you'll need to create an API Key & Secret, which you can generate on the Porkbun API page.
Once you have these details, you can configure the client with the following:
Porkbun.configure do |config|
config.api_key = ENV["PORKBUN_API_KEY"]
config.api_secret = ENV["PORKBUN_API_SECRET"]
end
Domains
Porkbun::Domain.list
Porkbun::Domain.get("deanpcmad.dev").name_servers
Porkbun::Domain.get("deanpcmad.dev").forwards
Porkbun::Domain.add_forward(
domain: "deanpcmad.dev",
subdomain: "site",
location: "https://deanpcmad.com",
type: "temporary",
include_path: true
)
Porkbun::Domain.delete("deanpcmad.dev", record: "123123")
Records
Porkbun::Record.list(domain: "deanpcmad.dev")
Porkbun::Record.list_by_type(domain: "deanpcmad.dev", type: "CNAME", subdomain: "*")
Porkbun::Record.retrieve(domain: "deanpcmad.dev", id: "123")
Porkbun::Domain.add_record(
domain: "deanpcmad.dev",
type: "A",
value: "1.2.3.4",
name: "test"
)
Porkbun::Domain.update_record(
domain: "deanpcmad.dev",
id: "123123",
type: "A",
value: "1.2.3.5",
name: "test"
)
Porkbun::Domain.delete_record(
domain: "deanpcmad.dev",
record: "www.deanpcmad.dev"
)
Porkbun::Record.delete_by_subdomain(
domain: "deanpcmad.dev",
type: "A",
subdomain: "test"
)
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/porkbunrb.
License
The gem is available as open source under the terms of the MIT License.