Class: Porkbun::DNS
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#prio ⇒ Object
Returns the value of attribute prio.
-
#ttl ⇒ Object
Returns the value of attribute ttl.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Abstract
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
- #delete ⇒ Object
- #edit ⇒ Object
-
#initialize(options) ⇒ DNS
constructor
A new instance of DNS.
Methods inherited from Abstract
Constructor Details
#initialize(options) ⇒ DNS
Returns a new instance of DNS.
45 46 47 48 49 50 51 52 53 |
# File 'lib/porkbun.rb', line 45 def initialize() @name = [:name] @content = [:content] @type = [:type] @ttl = [:ttl] || 600 @prio = [:prio] @domain = [:domain] @id = [:id] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def content @content end |
#domain ⇒ Object
Returns the value of attribute domain.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def domain @domain end |
#id ⇒ Object
Returns the value of attribute id.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def name @name end |
#notes ⇒ Object
Returns the value of attribute notes.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def notes @notes end |
#prio ⇒ Object
Returns the value of attribute prio.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def prio @prio end |
#ttl ⇒ Object
Returns the value of attribute ttl.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def ttl @ttl end |
#type ⇒ Object
Returns the value of attribute type.
43 44 45 |
# File 'lib/porkbun.rb', line 43 def type @type end |
Class Method Details
.create(options) ⇒ Object
55 56 57 58 |
# File 'lib/porkbun.rb', line 55 def self.create() record = DNS.new record.create end |
.retrieve(domain, id = nil) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/porkbun.rb', line 64 def self.retrieve(domain, id = nil) raise Error, 'need domain' unless domain res = Porkbun.porkbun File.join('dns/retrieve', domain, id || '').chomp('/') res[:records].map do |record| DNS.new record.merge(domain:) end end |
Instance Method Details
#create ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/porkbun.rb', line 81 def create res = Porkbun.porkbun File.join('dns/create', domain), { name:, content:, type:, ttl: } parse_response res @id = res[:id] self end |
#delete ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/porkbun.rb', line 73 def delete raise Error, 'Need ID to delete record' unless id res = Porkbun.porkbun File.join('dns/delete', domain, id) parse_response res self end |
#edit ⇒ Object
60 61 62 |
# File 'lib/porkbun.rb', line 60 def edit raise Error, 'need id to edit' unless @id end |