Object
Makes real connections to Softlayer.
# File lib/fog/softlayer/requests/dns/create_domain.rb, line 73 def create_domain(opts) request(:dns_domain, :create_object, :body => opts, :http_method => :POST) end
# File lib/fog/softlayer/requests/dns/create_record.rb, line 43 def create_record(opts) request(:dns_domain_resourceRecord, :create_object, :body => opts, :http_method => :POST) end
# File lib/fog/softlayer/requests/dns/delete_domain.rb, line 28 def delete_domain(id) request(:dns_domain, id.to_s, :http_method => :DELETE) end
# File lib/fog/softlayer/requests/dns/delete_record.rb, line 32 def delete_record(id) request(:dns_domain_resourceRecord, id.to_s, :http_method => :DELETE) end
# File lib/fog/softlayer/requests/dns/get_domain.rb, line 27 def get_domain(id) request(:dns_domain, id) end
# File lib/fog/softlayer/requests/dns/get_domain_by_name.rb, line 30 def get_domain_by_name(name) request(:dns_domain, "getByDomainName/" + URI::encode(name.to_s, "-")) end
# File lib/fog/softlayer/requests/dns/get_domains.rb, line 22 def get_domains request(:account, :get_domains) end
# File lib/fog/softlayer/requests/dns/get_record.rb, line 31 def get_record(id) request(:dns_domain_resourceRecord, id) end
# File lib/fog/softlayer/requests/dns/get_records.rb, line 27 def get_records(domain_id) request(:dns_domain, domain_id.to_s + '/getResourceRecords') end
Sends the real request to the real SoftLayer service.
@param [String] service
...ayer.com/rest/v3/Softlayer_Service_Name...
@param path [String]
...ayer.com/rest/v3/Softlayer_Service_Name/path.json
@param [Hash] options @option options [Array<Hash>] :body
HTTP request body parameters
@option options [String] :softlayer_api_url
Override the default (or configured) API endpoint
@option options [String] :softlayer_username
Email or user identifier for user based authentication
@option options [String] :softlayer_api_key
Password for user based authentication
@return [Excon::Response]
# File lib/fog/softlayer/dns.rb, line 80 def request(service, path, options={}) # default HTTP method to get if not passed http_method = options[:http_method] || :get # set the target base url @request_url = options[:softlayer_api_url] || Fog::Softlayer::SL_API_URL # tack on the username and password credentialize_url(@credentials[:username], @credentials[:api_key]) # set the SoftLayer Service name set_sl_service(service) # set the request path (known as the "method" in SL docs) set_sl_path(path) # set the query params if any # build request params params = { :headers => user_agent_header } params[:headers]['Content-Type'] = 'application/json' params[:expects] = options[:expected] || [200,201] params[:body] = Fog::JSON.encode({:parameters => [ options[:body] ]}) unless options[:body].nil? params[:query] = options[:query] unless options[:query].nil? # initialize connection object @connection = Fog::Core::Connection.new(@request_url, false, params) # send it response = @connection.request(:method => http_method) # decode it response.body = Fog::JSON.decode(response.body) response end
Generated with the Darkfish Rdoc Generator 2.