Class: RecordStore::Provider::NS1::ApiAnswer
- Inherits:
-
Object
- Object
- RecordStore::Provider::NS1::ApiAnswer
- Defined in:
- lib/record_store/provider/ns1.rb
Instance Attribute Summary collapse
-
#record_id ⇒ Object
Returns the value of attribute record_id.
-
#rrdata ⇒ Object
Returns the value of attribute rrdata.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
- .from_full_api_answer(type:, record_id:, answer:) ⇒ Object
- .from_short_api_answer(type:, record_id:, answer:) ⇒ Object
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(type:, record_id:, rrdata:) ⇒ ApiAnswer
constructor
A new instance of ApiAnswer.
- #rrdata_string ⇒ Object
Constructor Details
#initialize(type:, record_id:, rrdata:) ⇒ ApiAnswer
Returns a new instance of ApiAnswer.
26 27 28 29 30 |
# File 'lib/record_store/provider/ns1.rb', line 26 def initialize(type:, record_id:, rrdata:) @type = type @record_id = record_id @rrdata = rrdata end |
Instance Attribute Details
#record_id ⇒ Object
Returns the value of attribute record_id.
24 25 26 |
# File 'lib/record_store/provider/ns1.rb', line 24 def record_id @record_id end |
#rrdata ⇒ Object
Returns the value of attribute rrdata.
24 25 26 |
# File 'lib/record_store/provider/ns1.rb', line 24 def rrdata @rrdata end |
#type ⇒ Object
Returns the value of attribute type.
24 25 26 |
# File 'lib/record_store/provider/ns1.rb', line 24 def type @type end |
Class Method Details
.from_full_api_answer(type:, record_id:, answer:) ⇒ Object
8 9 10 |
# File 'lib/record_store/provider/ns1.rb', line 8 def from_full_api_answer(type:, record_id:, answer:) ApiAnswer.new(type: type, record_id: record_id, rrdata: answer['answer']) end |
.from_short_api_answer(type:, record_id:, answer:) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/record_store/provider/ns1.rb', line 12 def from_short_api_answer(type:, record_id:, answer:) rrdata_fields = case type when 'SPF', 'TXT' [answer] else answer.split end ApiAnswer.new(type: type, record_id: record_id, rrdata: rrdata_fields) end |
Instance Method Details
#id ⇒ Object
36 37 38 |
# File 'lib/record_store/provider/ns1.rb', line 36 def id [record_id, type, *rrdata] end |
#rrdata_string ⇒ Object
32 33 34 |
# File 'lib/record_store/provider/ns1.rb', line 32 def rrdata_string rrdata.join(' ') end |