Module: Dnsimple::Client::Services
- Included in:
- ServicesService
- Defined in:
- lib/dnsimple/client/services.rb
Instance Method Summary collapse
-
#all_services(options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service>
Lists ALL the available one-click services.
-
#service(service_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Service>
Gets the service with specified ID.
-
#services(options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service>
(also: #list_services)
Lists the available one-click services.
Instance Method Details
#all_services(options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service>
Lists ALL the available one-click services.
This method is similar to #services, 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.
56 57 58 |
# File 'lib/dnsimple/client/services.rb', line 56 def all_services( = {}) paginate(:services, ) end |
#service(service_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Service>
Gets the service with specified ID.
72 73 74 75 76 77 |
# File 'lib/dnsimple/client/services.rb', line 72 def service(service_id, = {}) endpoint = Client.versioned("/services/%s" % [service_id]) response = client.get(endpoint, ) Dnsimple::Response.new(response, Struct::Service.new(response["data"])) end |
#services(options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service> Also known as: list_services
Lists the available one-click services.
27 28 29 30 31 32 |
# File 'lib/dnsimple/client/services.rb', line 27 def services( = {}) endpoint = Client.versioned("/services") response = client.get(endpoint, Options::ListOptions.new()) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) }) end |