Module: Dnsimple::Client::Services

Included in:
ServicesService
Defined in:
lib/dnsimple/client/services.rb

Instance Method Summary collapse

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.

Examples:

List all the one-click services:

client.services.all_services

Parameters:

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



43
44
45
# File 'lib/dnsimple/client/services.rb', line 43

def all_services(options = {})
  paginate(:services, options)
end

#service(service_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Service>

Gets the service with specified ID.

Examples:

Get service 43:

client.services.service(43)

Parameters:

  • service_id (#to_s)

    The service ID

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



60
61
62
63
64
65
# File 'lib/dnsimple/client/services.rb', line 60

def service(service_id, options = {})
  endpoint = Client.versioned("/services/%s" % [service_id])
  response = client.get(endpoint, options)

  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.

Examples:

List one-click services:

client.services.list_services

Parameters:

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



16
17
18
19
20
21
# File 'lib/dnsimple/client/services.rb', line 16

def services(options = {})
  endpoint = Client.versioned("/services")
  response = client.get(endpoint, options)

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) })
end