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, #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.
59 60 61 |
# File 'lib/dnsimple/client/zones.rb', line 59 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.
74 75 76 77 78 |
# File 'lib/dnsimple/client/zones.rb', line 74 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.
91 92 93 94 95 |
# File 'lib/dnsimple/client/zones.rb', line 91 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, list_zones
Lists the zones in the account.
31 32 33 34 35 |
# File 'lib/dnsimple/client/zones.rb', line 31 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 |