Class: Cloudflare::DNS::Record

Inherits:
Representation
  • Object
show all
Defined in:
lib/cloudflare/dns.rb

Instance Method Summary collapse

Methods inherited from Representation

#process_response, #represent, #represent_message, #representation, #to_hash

Constructor Details

#initialize(url, record = nil, **options) ⇒ Record

Returns a new instance of Record.



31
32
33
34
35
# File 'lib/cloudflare/dns.rb', line 31

def initialize(url, record = nil, **options)
	super(url, **options)

	@record = record || get.result
end

Instance Method Details

#contentObject



56
57
58
# File 'lib/cloudflare/dns.rb', line 56

def content
	value[:content]
end

#nameObject



52
53
54
# File 'lib/cloudflare/dns.rb', line 52

def name
	value[:name]
end

#proxiedObject



60
61
62
# File 'lib/cloudflare/dns.rb', line 60

def proxied
	value[:proxied]
end

#to_sObject



64
65
66
# File 'lib/cloudflare/dns.rb', line 64

def to_s
	"#{@record[:name]} #{@record[:type]} #{@record[:content]}"
end

#typeObject



48
49
50
# File 'lib/cloudflare/dns.rb', line 48

def type
	value[:type]
end

#update_content(content, **options) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/cloudflare/dns.rb', line 37

def update_content(content, **options)
	response = put(
		type: @record[:type],
		name: @record[:name],
		content: content,
		**options
	)

	@value = response.result
end