Module: Dnsimple::Client::ServicesDomains
- Included in:
- ServicesService
- Defined in:
- lib/dnsimple/client/services_domains.rb
Instance Method Summary collapse
-
#applied(domain, options = {}) ⇒ Array<Struct::Service>
Lists the services applied to a domain.
-
#apply(domain, service, options = {}) ⇒ void
Applies a service to a domain.
-
#available(domain, options = {}) ⇒ Array<Struct::Service>
Lists the services not applied to a domain.
-
#unapply(domain, service, options = {}) ⇒ void
Un-applies a service from a domain.
Instance Method Details
#applied(domain, options = {}) ⇒ Array<Struct::Service>
Lists the services applied to a domain.
14 15 16 17 18 |
# File 'lib/dnsimple/client/services_domains.rb', line 14 def applied(domain, = {}) response = client.get(Client.versioned("domains/#{domain}/applied_services"), ) response.map { |r| Struct::Service.new(r["service"]) } end |
#apply(domain, service, options = {}) ⇒ void
This method returns an undefined value.
Applies a service to a domain.
45 46 47 48 49 |
# File 'lib/dnsimple/client/services_domains.rb', line 45 def apply(domain, service, = {}) = Extra.deep_merge(, { service: { id: service }}) response = client.post(Client.versioned("domains/#{domain}/applied_services"), ) response.code == 200 end |
#available(domain, options = {}) ⇒ Array<Struct::Service>
Lists the services not applied to a domain.
29 30 31 32 33 |
# File 'lib/dnsimple/client/services_domains.rb', line 29 def available(domain, = {}) response = client.get(Client.versioned("domains/#{domain}/available_services"), ) response.map { |r| Struct::Service.new(r["service"]) } end |
#unapply(domain, service, options = {}) ⇒ void
This method returns an undefined value.
Un-applies a service from a domain.
61 62 63 64 |
# File 'lib/dnsimple/client/services_domains.rb', line 61 def unapply(domain, service, = {}) response = client.delete(Client.versioned("domains/#{domain}/applied_services/#{service}"), ) response.code == 200 end |