class Samenessed::Principal
Public Class Methods
fetch_identity(from_account_type, from_account_name, to_account_type)
click to toggle source
Retrieves the target identity for the given origin data. Returns a string with the target identity or nil if no matching principal could be found Arguments:
-
from_account_type : The type of the origin account
-
from_account_name : The id of the origin account
-
to_account_type : The type of the target account
# File lib/samenessed/principal.rb, line 13 def self.fetch_identity(from_account_type, from_account_name, to_account_type) h = fetch_principal from_account_type, from_account_name, to_account_type unless h.nil? h["name"] else nil end end
fetch_principal(from_account_type, from_account_name, to_account_type)
click to toggle source
# File lib/samenessed/principal.rb, line 23 def self.fetch_principal(from_account_type, from_account_name, to_account_type) raise ArgumentError, "No from account type given!" if from_account_type.nil? raise ArgumentError, "No from account name given!" if from_account_name.nil? raise ArgumentError, "No to account type given!" if to_account_type.nil? h = Principal.get(:fetch, { :from => { :account_type => from_account_type, :name => from_account_name }, :to => { :account_type => to_account_type } } ) return h end