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>
(also: #all)
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, #list_services)
Lists the available one-click services.
Instance Method Details
#all_services(options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service> Also known as: all
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.
43 44 45 |
# File 'lib/dnsimple/client/services.rb', line 43 def all_services( = {}) paginate(:services, ) end |
#service(service_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Service>
Gets the service with specified ID.
60 61 62 63 64 65 |
# File 'lib/dnsimple/client/services.rb', line 60 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, list_services
Lists the available one-click services.
16 17 18 19 20 21 |
# File 'lib/dnsimple/client/services.rb', line 16 def services( = {}) endpoint = Client.versioned("/services") response = client.get(endpoint, ) Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) }) end |