Class: RecordStore::Provider::NS1

Inherits:
RecordStore::Provider show all
Defined in:
lib/record_store/provider/ns1.rb,
lib/record_store/provider/ns1/client.rb

Defined Under Namespace

Classes: ApiAnswer, Client

Class Method Summary collapse

Methods inherited from RecordStore::Provider

apply_changeset, build_zone, empty_non_terminal_over_wildcard?, freezable?, provider_for, supports_alias?, thawable?, to_s

Class Method Details

.clientObject



49
50
51
# File 'lib/record_store/provider/ns1.rb', line 49

def client
  Provider::NS1::Client.new(api_key: secrets['api_key'])
end

.record_typesObject



45
46
47
# File 'lib/record_store/provider/ns1.rb', line 45

def record_types
  super | Set.new(%w(PTR))
end

.retrieve_current_records(zone:, stdout: $stdout) ⇒ Object

Downloads all the records from the provider.

Returns: an array of ‘Record` for each record in the provider’s zone



56
57
58
59
60
# File 'lib/record_store/provider/ns1.rb', line 56

def retrieve_current_records(zone:, stdout: $stdout)
  records_for_zone(zone)
    .flat_map { |short_record| build_from_api(short_record) }
    .compact
end

.zonesObject

Returns an array of the zones managed by provider as strings



63
64
65
66
67
# File 'lib/record_store/provider/ns1.rb', line 63

def zones
  retry_on_connection_errors do
    client.zones.map { |zone| zone['zone'] }
  end
end