Module: Dnsimple::Client::Zones
- Included in:
- ZonesService
- Defined in:
- lib/dnsimple/client/zones.rb
Instance Method Summary collapse
-
#all_zones(account_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::Zone>
Lists ALL the zones in the account.
-
#zone(account_id, zone_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Zone>
Gets a zone from the account.
-
#zone_file(account_id, zone_name, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::ZoneFile>
Gets a zone file from the account.
-
#zones(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Zone>
(also: #list_zones)
Lists the zones in the account.
Instance Method Details
#all_zones(account_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::Zone>
Lists ALL the zones in the account.
This method is similar to #zones, but instead of returning the results of a specific page it iterates all the pages and returns the entire collection.
Please use this method carefully, as fetching the entire collection will increase the number of requests you send to the API server and you may eventually risk to hit the throttle limit.
60 61 62 |
# File 'lib/dnsimple/client/zones.rb', line 60 def all_zones(account_id, = {}) paginate(:zones, account_id, ) end |
#zone(account_id, zone_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Zone>
Gets a zone from the account.
75 76 77 78 79 |
# File 'lib/dnsimple/client/zones.rb', line 75 def zone(account_id, zone_id, = {}) response = client.get(Client.versioned("/%s/zones/%s" % [account_id, zone_id]), ) Dnsimple::Response.new(response, Struct::Zone.new(response["data"])) end |
#zone_file(account_id, zone_name, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::ZoneFile>
Gets a zone file from the account.
92 93 94 95 96 |
# File 'lib/dnsimple/client/zones.rb', line 92 def zone_file(account_id, zone_name, = {}) response = client.get(Client.versioned("/%s/zones/%s/file" % [account_id, zone_name]), ) Dnsimple::Response.new(response, Struct::ZoneFile.new(response["data"])) end |
#zones(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Zone> Also known as: list_zones
Lists the zones in the account.
33 34 35 36 37 |
# File 'lib/dnsimple/client/zones.rb', line 33 def zones(account_id, = {}) response = client.get(Client.versioned("/%s/zones" % [account_id]), Options::ListOptions.new()) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Zone.new(r) }) end |