module Zaikio::Directory::Asset
Public Instance Methods
destroy()
click to toggle source
# File lib/zaikio/directory/asset.rb, line 22 def destroy if Zaikio::Directory.current_token_data.subject_type == "Organization" self.class.request(:delete, "#{collection_name}/#{id}/#{singular_name}_ownership") else org_path = "person/organizations/#{owner_id || organization_id}" self.class.request(:delete, "#{org_path}/#{collection_name}/#{id}/#{singular_name}_ownership") end end
make_organization_owner()
click to toggle source
# File lib/zaikio/directory/asset.rb, line 11 def make_organization_owner if Zaikio::Directory.current_token_data.subject_type == "Organization" self.class.request(:post, "#{collection_name}/#{id}/#{singular_name}_ownership") else org_path = "person/organizations/#{organization_id}" self.class.request(:post, "#{org_path}/#{collection_name}/#{id}/#{singular_name}_ownership") end end
specification()
click to toggle source
# File lib/zaikio/directory/asset.rb, line 33 def specification prefix = if Zaikio::Directory.current_token_data.subject_type == "Person" "person/organizations/#{owner_id || organization_id}/" else "" end self.class.request(:get, "#{prefix}#{collection_name}/#{id}/#{singular_name}_specification") &.body&.dig("data") end
Private Instance Methods
collection_name()
click to toggle source
# File lib/zaikio/directory/asset.rb, line 46 def collection_name self.class.name.demodulize.underscore.pluralize end
singular_name()
click to toggle source
# File lib/zaikio/directory/asset.rb, line 50 def singular_name self.class.name.demodulize.underscore end