Class: SFRest::Domains
- Inherits:
-
Object
- Object
- SFRest::Domains
- Defined in:
- lib/sfrest/domains.rb
Overview
Find Staging envs and stage a set of sites
Instance Method Summary collapse
-
#add(node_id, domain_name) ⇒ Hash
Add a domain.
-
#custom_domains(node_id) ⇒ Array
Get the custom domains on a node.
-
#get(node_id) ⇒ Hash
Get the domains information on a node.
-
#get_all(**opts) ⇒ Hash
Get all domains of all sites known to site factory.
-
#initialize(conn) ⇒ Domains
constructor
A new instance of Domains.
-
#protected_domains(node_id) ⇒ Array
Get the protetect domains on a node.
-
#remove(node_id, domain_name) ⇒ Hash
Remove a domain.
-
#status(domain_name) ⇒ Hash
Get domain status.
Constructor Details
#initialize(conn) ⇒ Domains
Returns a new instance of Domains.
7 8 9 |
# File 'lib/sfrest/domains.rb', line 7 def initialize(conn) @conn = conn end |
Instance Method Details
#add(node_id, domain_name) ⇒ Hash
Add a domain
60 61 62 63 |
# File 'lib/sfrest/domains.rb', line 60 def add(node_id, domain_name) payload = { 'domain_name' => domain_name }.to_json @conn.post("/api/v1/domains/#{node_id}/add", payload) end |
#custom_domains(node_id) ⇒ Array
Get the custom domains on a node
40 41 42 |
# File 'lib/sfrest/domains.rb', line 40 def custom_domains(node_id) get(node_id)['domains']['custom_domains'] end |
#get(node_id) ⇒ Hash
Get the domains information on a node
18 19 20 21 |
# File 'lib/sfrest/domains.rb', line 18 def get(node_id) current_path = "/api/v1/domains/#{node_id}" @conn.get(current_path) end |
#get_all(**opts) ⇒ Hash
Get all domains of all sites known to site factory.
31 32 33 34 |
# File 'lib/sfrest/domains.rb', line 31 def get_all(**opts) current_path = "/api/v1/domains?#{URI.encode_www_form(opts)}" @conn.get(current_path) end |
#protected_domains(node_id) ⇒ Array
Get the protetect domains on a node
48 49 50 |
# File 'lib/sfrest/domains.rb', line 48 def protected_domains(node_id) get(node_id)['domains']['protected_domains'] end |
#remove(node_id, domain_name) ⇒ Hash
Remove a domain
73 74 75 76 |
# File 'lib/sfrest/domains.rb', line 73 def remove(node_id, domain_name) payload = { 'domain_name' => domain_name }.to_json @conn.post("/api/v1/domains/#{node_id}/remove", payload) end |
#status(domain_name) ⇒ Hash
Get domain status
91 92 93 |
# File 'lib/sfrest/domains.rb', line 91 def status(domain_name) @conn.get("/api/v1/domains/status/#{domain_name}") end |