class SFRest::Domains
Find Staging envs and stage a set of sites
Public Class Methods
@param [SFRest::Connection] conn
# File lib/sfrest/domains.rb, line 7 def initialize(conn) @conn = conn end
Public Instance Methods
Add a domain @param [Integer] node_id The id of the node to which add a domain @param [String] domain_name domain to add. e.g. www.example.com
@return [Hash] { “node_type”: “site_collection”,
"domain": "www.example.com", "added": true, "messages": [ "Your domain name was successfully added to the site collection."] }
# File lib/sfrest/domains.rb, line 47 def add(node_id, domain_name) payload = { 'domain_name' => domain_name }.to_json @conn.post("/api/v1/domains/#{node_id}/add", payload) end
Get the custom domains on a node @param [Integer] node_id The id of the node.
@return [Array] custom(removable) domains on a node
# File lib/sfrest/domains.rb, line 27 def custom_domains(node_id) get(node_id)['domains']['custom_domains'] end
Get the domains information on a node @param [Integer] node_id The id of the node.
@return [Hash] { “node_id” => 4966, “node_type” => “site”,
"time" => "2016-11-18T20:09:55+00:00", "domains" => { "protected_domains" =>[ "it252garden4.utest.sfdev.acquia-test.co" ], "custom_domains" => [ "it252coll3.utest.sfdev.acquia-test.co", "sc1.nikgregory.us" ] } }
# File lib/sfrest/domains.rb, line 18 def get(node_id) current_path = "/api/v1/domains/#{node_id}" @conn.get(current_path) end
Get the protetect domains on a node @param [Integer] node_id The id of the node.
@return [Array] protected (non-removable) domains on a node
# File lib/sfrest/domains.rb, line 35 def protected_domains(node_id) get(node_id)['domains']['protected_domains'] end
Remove a domain @param [Integer] node_id The id of the node to which remove a domain @param [String] domain_name domain to remove. e.g. www.example.com
@return [Hash] { “node_type”: “site_collection”,
"domain": "www.example.com", "removed": true, "messages": [ "Your domain name was successfully removed from the site collection." ] }
# File lib/sfrest/domains.rb, line 60 def remove(node_id, domain_name) payload = { 'domain_name' => domain_name }.to_json @conn.post("/api/v1/domains/#{node_id}/remove", payload) end
Get domain status @param [String] domain_name domain to remove. e.g. www.example.com
@return [Hash] { “message” => “The domain is associated with the node.”,
"is_domain_associated" => TRUE, "node_id" => 123, "node_type" => "site", "time" => "2016-10-28T09:25:26+00:00", "stack_id" => 1, "domains" => array( "protected_domains" => array('site.example.sfdev.acquia-test.co'), "custom_domains" => array('www.abc.com/def', 'www.xyz.com'), ) }
# File lib/sfrest/domains.rb, line 78 def status(domain_name) @conn.get("/api/v1/domains/status/#{domain_name}") end