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.
-
#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.
45 46 47 |
# File 'lib/dnsimple/client/zones.rb', line 45 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.
60 61 62 63 64 |
# File 'lib/dnsimple/client/zones.rb', line 60 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 |
#zones(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Zone> Also known as: list, list_zones
Lists the zones in the account.
21 22 23 24 25 |
# File 'lib/dnsimple/client/zones.rb', line 21 def zones(account_id, = {}) response = client.get(Client.versioned("/%s/zones" % [account_id]), ) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Zone.new(r) }) end |