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.
-
#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.
Constructor Details
#initialize(conn) ⇒ Domains
Returns a new instance of Domains.
5 6 7 |
# File 'lib/sfrest/domains.rb', line 5 def initialize(conn) @conn = conn end |
Instance Method Details
#add(node_id, domain_name) ⇒ Hash
Add a domain
45 46 47 48 |
# File 'lib/sfrest/domains.rb', line 45 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
25 26 27 |
# File 'lib/sfrest/domains.rb', line 25 def custom_domains(node_id) get(node_id)['domains']['custom_domains'] end |
#get(node_id) ⇒ Hash
Get the domains information on a node
16 17 18 19 |
# File 'lib/sfrest/domains.rb', line 16 def get(node_id) current_path = "/api/v1/domains/#{node_id}" @conn.get(current_path) end |
#protected_domains(node_id) ⇒ Array
Get the protetect domains on a node
33 34 35 |
# File 'lib/sfrest/domains.rb', line 33 def protected_domains(node_id) get(node_id)['domains']['protected_domains'] end |
#remove(node_id, domain_name) ⇒ Hash
Remove a domain
58 59 60 61 |
# File 'lib/sfrest/domains.rb', line 58 def remove(node_id, domain_name) payload = { 'domain_name' => domain_name }.to_json @conn.post("/api/v1/domains/#{node_id}/remove", payload) end |