module Delphix
Public Class Methods
authenticate!(username,password)
click to toggle source
# File lib/delphix.rb, line 22 def authenticate!(username,password) case when !username.is_a?(String) raise ArgumentError, "Expected a String, got: '#{username}'" when !password.is_a?(String) raise ArgumentError, "Expected a String, got: '#{password}'" end reset_connection! # create a session session = { :type => 'APISession', :version => { :type => 'APIVersion', # Delphix Engine 4.3.1.x and above :major => 1, :minor => 6, :micro => 0 } } post('/resources/json/delphix/session', session.to_json) # authenticate the session auth = { :type => 'LoginRequest', :username => username, :password => password } post('/resources/json/delphix/login', auth.to_json) end
connection()
click to toggle source
# File lib/delphix.rb, line 104 def connection @connection ||= Connection.new(url, options) end
debug()
click to toggle source
# File lib/delphix.rb, line 94 def debug @debug || false end
debug=(new_value)
click to toggle source
# File lib/delphix.rb, line 98 def debug=(new_value) @debug = new_value end
default_url()
click to toggle source
# File lib/delphix.rb, line 116 def default_url 'http://localhost' end
delete(endpoint, payload=nil)
click to toggle source
a generic delete method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 71 def delete(endpoint, payload=nil) connection.delete( endpoint, {}, :body => payload) end
env_options()
click to toggle source
# File lib/delphix.rb, line 120 def env_options {} end
env_url()
click to toggle source
# File lib/delphix.rb, line 112 def env_url ENV['DELPHIX_URL'] || default_url end
get(endpoint, payload=nil)
click to toggle source
a generic get method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 56 def get(endpoint, payload=nil) connection.get( endpoint, {}, :body => payload) end
options()
click to toggle source
# File lib/delphix.rb, line 85 def options @options ||= env_options end
options=(new_options)
click to toggle source
# File lib/delphix.rb, line 89 def options=(new_options) @options = env_options.merge(new_options || {}) reset_connection! end
post(endpoint, payload=nil)
click to toggle source
a generic post method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 61 def post(endpoint, payload=nil) connection.post( endpoint, {}, :body => payload) end
put(endpoint, payload=nil)
click to toggle source
a generic put method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 66 def put(endpoint, payload=nil) connection.put( endpoint, {}, :body => payload) end
reset_connection!()
click to toggle source
# File lib/delphix.rb, line 108 def reset_connection! @connection = nil end
url()
click to toggle source
# File lib/delphix.rb, line 75 def url @url ||= env_url @url end
url=(new_url)
click to toggle source
# File lib/delphix.rb, line 80 def url=(new_url) @url = new_url reset_connection! end
Private Instance Methods
authenticate!(username,password)
click to toggle source
# File lib/delphix.rb, line 22 def authenticate!(username,password) case when !username.is_a?(String) raise ArgumentError, "Expected a String, got: '#{username}'" when !password.is_a?(String) raise ArgumentError, "Expected a String, got: '#{password}'" end reset_connection! # create a session session = { :type => 'APISession', :version => { :type => 'APIVersion', # Delphix Engine 4.3.1.x and above :major => 1, :minor => 6, :micro => 0 } } post('/resources/json/delphix/session', session.to_json) # authenticate the session auth = { :type => 'LoginRequest', :username => username, :password => password } post('/resources/json/delphix/login', auth.to_json) end
connection()
click to toggle source
# File lib/delphix.rb, line 104 def connection @connection ||= Connection.new(url, options) end
debug()
click to toggle source
# File lib/delphix.rb, line 94 def debug @debug || false end
debug=(new_value)
click to toggle source
# File lib/delphix.rb, line 98 def debug=(new_value) @debug = new_value end
default_url()
click to toggle source
# File lib/delphix.rb, line 116 def default_url 'http://localhost' end
delete(endpoint, payload=nil)
click to toggle source
a generic delete method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 71 def delete(endpoint, payload=nil) connection.delete( endpoint, {}, :body => payload) end
env_options()
click to toggle source
# File lib/delphix.rb, line 120 def env_options {} end
env_url()
click to toggle source
# File lib/delphix.rb, line 112 def env_url ENV['DELPHIX_URL'] || default_url end
get(endpoint, payload=nil)
click to toggle source
a generic get method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 56 def get(endpoint, payload=nil) connection.get( endpoint, {}, :body => payload) end
options()
click to toggle source
# File lib/delphix.rb, line 85 def options @options ||= env_options end
options=(new_options)
click to toggle source
# File lib/delphix.rb, line 89 def options=(new_options) @options = env_options.merge(new_options || {}) reset_connection! end
post(endpoint, payload=nil)
click to toggle source
a generic post method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 61 def post(endpoint, payload=nil) connection.post( endpoint, {}, :body => payload) end
put(endpoint, payload=nil)
click to toggle source
a generic put method, used when there is not specialized method to invoke an API call
# File lib/delphix.rb, line 66 def put(endpoint, payload=nil) connection.put( endpoint, {}, :body => payload) end
reset_connection!()
click to toggle source
# File lib/delphix.rb, line 108 def reset_connection! @connection = nil end
url()
click to toggle source
# File lib/delphix.rb, line 75 def url @url ||= env_url @url end
url=(new_url)
click to toggle source
# File lib/delphix.rb, line 80 def url=(new_url) @url = new_url reset_connection! end