module PIM::Services::OrganizationService

Public Instance Methods

delete_managed_organization(managed_organization_id) click to toggle source
# File services.rb, line 3818
def delete_managed_organization managed_organization_id
  __organization_service.deleteManagedOrganization(managed_organization_id)
end
delete_managed_organization_user(managed_organization_id, user_email_address) click to toggle source
# File services.rb, line 3814
def delete_managed_organization_user managed_organization_id, user_email_address
  __organization_service.deleteManagedOrganizationUser(managed_organization_id, user_email_address)
end
get_all_managed_organization_users(managed_organization_id) click to toggle source

Retrieves all the users of the managed organization specified by its ‘organizationId’

Arguments

  • managed_organization_id: id of the managed organization

# File services.rb, line 3778
def get_all_managed_organization_users managed_organization_id
  __organization_service.getAllManagedOrganizationUsers(managed_organization_id)
end
get_base_url() click to toggle source

Returns the base URL registered for the current organization.

# File services.rb, line 3739
def get_base_url
  __cached(:base_url) { __organization_service.getBaseUrl() }
end
get_managed_organization(id: nil, custom_organization_id: nil) click to toggle source

This method returns the managed organization for the given parameters.

  • id: id of the managed organization

  • custom_organization_id: custom organization id of the managed organization

# File services.rb, line 3828
def get_managed_organization id: nil, custom_organization_id: nil

  if not id.nil?
    __organization_service.getManagedOrganization(id)
  elsif not custom_organization_id.nil?
    __organization_service.getManagedOrganizationByCustomId(custom_organization_id.to_s)
  end

end
get_organization() click to toggle source

Returns the current organization object.

# File services.rb, line 3729
def get_organization
  organization = __cached(:organization) { __convert(__organization_service.getCurrentOrganization(), to: Organization) }
  raise "No current organization found" if organization.nil?
  organization
end
update_managed_organization(managed_organization_id, values = {}) click to toggle source

Updates the managed organization for the specified ‘organizationId’ with the provided values.

Retrieve the organizationId e.g. by searching for the appropriate contact (see PIM::Services::ContactService.search_contacts_by_custom_value) and then accessing ‘contact.organization_id’.

Alternatively, simply use the provided ‘contact’ object in a ‘contact_saved’ workflow event!

The following values can be updated on a managed organization:

  • name

  • address

  • email

  • gln

  • url

  • locale_specific_number_format

  • custom_values

Only the values specified will be updated, e.g.

-> update_managed_organization(123, custom_values: { simple_attribute: ‘abc’ })

will only update the specified custom organization attribute ‘simple_attribute’!

To explicitly clear a value on a managed organization, simply set it to “nil”, e,g.

-> update_managed_organization(123, address: nil, custom_values: { other_attribute: nil })

# File services.rb, line 3810
def update_managed_organization managed_organization_id, values = {}
  __organization_service.updateManagedOrganization(managed_organization_id, PIM::Utils.unsymbolized_camelized_hash(values))
end
update_organization(values = {}) click to toggle source

Updates the current organization with the provided values.

The following values can be updated on the current organization:

  • name

  • address

  • email

  • gln

  • url

  • locale_specific_number_format

  • custom_values

Only the values specified will be updated, e.g.

-> update_organization(custom_values: { simple_attribute: ‘abc’ })

will only update the specified custom organization attribute ‘simple_attribute’!

To explicitly clear a value on a managed organization, simply set it to “nil”, e,g.

-> update_organization(address: nil, custom_values: { other_attribute: nil })

# File services.rb, line 3765
def update_organization values = {}
  __organization_service.updateCurrentOrganization(PIM::Utils.unsymbolized_camelized_hash(values))
  __remove_from_cache(:organization)
end