Class: Matchd::Response
- Inherits:
-
Object
- Object
- Matchd::Response
- Defined in:
- lib/matchd/response.rb
Defined Under Namespace
Modules: Factory Classes: A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT
Constant Summary collapse
- NotImplementedError =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#resource_options ⇒ Object
readonly
Returns the value of attribute resource_options.
Instance Method Summary collapse
- #call(transaction) ⇒ Object
-
#initialize(options) ⇒ Response
constructor
A new instance of Response.
- #resource ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(options) ⇒ Response
Returns a new instance of Response.
19 20 21 22 23 24 25 26 27 |
# File 'lib/matchd/response.rb', line 19 def initialize() @resource_options = {} return unless .is_a?(Hash) @resource_options[:ttl] = ["ttl"] if .key?("ttl") @resource_options[:name] = ["name"] if .key?("name") @resource_options[:section] = ["section"] if .key?("section") end |
Instance Attribute Details
#resource_options ⇒ Object (readonly)
Returns the value of attribute resource_options.
29 30 31 |
# File 'lib/matchd/response.rb', line 29 def @resource_options end |
Instance Method Details
#call(transaction) ⇒ Object
35 36 37 |
# File 'lib/matchd/response.rb', line 35 def call(transaction) transaction.add([resource], ) end |
#resource ⇒ Object
31 32 33 |
# File 'lib/matchd/response.rb', line 31 def resource raise NotImplementedError end |
#valid? ⇒ Boolean
39 40 41 42 43 44 |
# File 'lib/matchd/response.rb', line 39 def valid? # TODO: this needs to be more suffisticated resource && true rescue ArgumentError false end |