Class: Porkbun::Domain
- Defined in:
- lib/porkbun/models/domain.rb
Class Method Summary collapse
- .add_forward(domain:, location:, type:, include_path: false, wildcard: false, **options) ⇒ Object
- .delete_forward(domain:, record:) ⇒ Object
- .forwards(domain:) ⇒ Object
- .list ⇒ Object
- .name_servers(domain:) ⇒ Object
Methods inherited from Object
Constructor Details
This class inherits a constructor from Porkbun::Object
Class Method Details
.add_forward(domain:, location:, type:, include_path: false, wildcard: false, **options) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/porkbun/models/domain.rb', line 22 def add_forward(domain:, location:, type:, include_path: false, wildcard: false, **) body = { domain: domain, location: location, type: type, includePath: include_path ? "yes" : "no", wildcard: wildcard ? "yes" : "no", }.merge() response = Client.post_request("domain/addUrlForward/#{domain}", body: body) response.body["status"] == "SUCCESS" end |
.delete_forward(domain:, record:) ⇒ Object
34 35 36 37 |
# File 'lib/porkbun/models/domain.rb', line 34 def delete_forward(domain:, record:) response = Client.post_request("domain/deleteUrlForward/#{domain}/#{record}", body: {}) response.body["status"] == "SUCCESS" end |
.forwards(domain:) ⇒ Object
17 18 19 20 |
# File 'lib/porkbun/models/domain.rb', line 17 def forwards(domain:) response = Client.post_request("domain/getUrlForwarding/#{domain}", body: {}) Collection.from_response(response, type: Forward, key: "forwards") end |
.list ⇒ Object
6 7 8 9 |
# File 'lib/porkbun/models/domain.rb', line 6 def list response = Client.post_request("domain/listAll", body: {}) Collection.from_response(response, type: Domain, key: "domains") end |
.name_servers(domain:) ⇒ Object
11 12 13 14 15 |
# File 'lib/porkbun/models/domain.rb', line 11 def name_servers(domain:) response = Client.post_request("domain/getNs/#{domain}", body: {}) data = response.body["ns"].map { |attrs| NameServer.new(ns: attrs) } Collection.new data: data, total: data.size end |