Module: Dnsimple::Client::ServicesDomains

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

Instance Method Summary collapse

Instance Method Details

#applied_services(account_id, domain_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Service>

Lists the one-click services applied to the domain.

Examples:

List applied one-click services for example.com:

client.service.applied_services(1010, "example.com")

List applied one-click services for example.com, provide a specific page:

client.services.applied_services(1010, "example.com", page: 2)

List applied one-click services for example.com, provide a sorting policy:

client.services.applied_services(1010, "example.com", sort: "short_name:asc")

Parameters:

  • account_id (Integer)

    the account ID

  • domain_id (#to_s)

    the domain name

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

    the filtering and sorting options

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

  • :sort (String)

    sorting policy

Returns:

Raises:

See Also:


29
30
31
32
33
34
# File 'lib/dnsimple/client/services_domains.rb', line 29

def applied_services(, domain_id, options = {})
  endpoint = Client.versioned("/%s/domains/%s/services" % [, domain_id])
  response = client.get(endpoint, Options::ListOptions.new(options))

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

#apply_service(account_id, service_id, domain_id, settings = {}, options = {}) ⇒ Dnsimple::Response<nil>

Apply a given one-click service to the domain.

Examples:

Apply one-click service service1 to example.com:

client.domain_services.applied_services(1010, "example.com", "service1")

Apply one-click service service1 to example.com, provide optional settings:

client.domain_services.applied_services(1010, "example.com", "service1", app: "foo")

Parameters:

  • account_id (Integer)

    the account ID

  • service_id (#to_s)

    the service name (or ID)

  • domain_id (#to_s)

    the domain name

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

    optional settings to apply the one-click service

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

Returns:

Raises:

See Also:


54
55
56
57
58
59
# File 'lib/dnsimple/client/services_domains.rb', line 54

def apply_service(, service_id, domain_id, settings = {}, options = {})
  endpoint = Client.versioned("/%s/domains/%s/services/%s" % [, domain_id, service_id])
  response = client.post(endpoint, settings, options)

  Dnsimple::Response.new(response, nil)
end

#unapply_service(account_id, service_id, domain_id, options = {}) ⇒ Dnsimple::Response<nil>

Unapply a given one-click service from the domain.

Examples:

Unapply one-click service service1 from example.com:

client.domain_services.applied_services(1010, "example.com", "service1")

Parameters:

  • account_id (Integer)

    the account ID

  • service_id (#to_s)

    the service name (or ID)

  • domain_id (#to_s)

    the domain name

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

Returns:

Raises:

See Also:


75
76
77
78
79
80
# File 'lib/dnsimple/client/services_domains.rb', line 75

def unapply_service(, service_id, domain_id, options = {})
  endpoint = Client.versioned("/%s/domains/%s/services/%s" % [, domain_id, service_id])
  response = client.delete(endpoint, options)

  Dnsimple::Response.new(response, nil)
end