module PIM::Services::InvitationService

Public Instance Methods

__invitation_service() click to toggle source
# File services.rb, line 1683
def __invitation_service
  __service(:emailInvitationService)
end
invite_colleague(email_address, opts = {}) click to toggle source

Sends an invitation for an colleague.

Possible settings for ‘opts’:

roles:

  • Sets an Array of initial roles for the new user

restriction_filter

  • The name of an item ‘filter’ which should be applied to all queries for the new user

restriction_query

  • A full item ‘query’ which should be applied to all queries for the new user Note: A ‘restriction_filter’ always takes precedence over a ‘restriction_query’!

custom_values:

  • Sets a Hash of initial custom values for the new user

language:

  • Sets the language to use in the invitation email

# File services.rb, line 1591
def invite_colleague email_address, opts = {}

  roles = PIM.get_value(opts, :roles)
  restriction_filter = PIM.get_value(opts, :restriction_filter, :restrictionFilter)
  restriction_query = PIM.get_value(opts, :restriction_query, :restrictionQuery)
  custom_values = PIM.get_value(opts, :custom_values, :customValues)

  language = PIM.get_value(opts, :language)

  __invitation_service.inviteColleague(email_address,
                                       roles,
                                       restriction_filter,
                                       restriction_query,
                                       PIM.javaify_hash(custom_values),
                                       language)
end
invite_organization(email_address, invitation_type, opts = {}) click to toggle source

Sends an invitation for an organization.

Set ‘invitation_type’ to either ‘INVITED_BUYER’, ‘INVITED_SUPPLIER’ or ‘INVITED_COMMUNITY_MEMBER’. Possible settings for ‘opts’:

organization_name:

  • Sets the (proposed) organization name for the invitation

organization_custom_id:

  • Sets a “unique” ID (per inviting organization), which ensures that the organization is only created once. Any additional invitation for the same custom organization id will create a new user (‘colleague’) on that invited organization. Note: This can only be applied, if invitation_type is either ‘INVITED_BUYER’ or ‘INVITED_SUPPLIER’!

organization_custom_values:

  • Sets a Hash of initial custom values to set on the newly created organization. Note: If the organization already exists (see custom_organization_id), the values are NOT set!

language:

  • Sets the language to use in the invitation email

Additionally, you can set values for the new user. Note: These can only be applied, if invitation_type is either ‘INVITED_BUYER’ or ‘INVITED_SUPPLIER’!

user_roles:

  • Sets an Array of initial roles for the new user. This will be set to ‘admin’ by default.

user_restriction_filter

  • The name of an item ‘filter’ which should be applied to all queries for the new user

user_restriction_query

  • A full item ‘query’ which should be applied to all queries for the new user Note: A ‘restriction_filter’ always takes precedence over a ‘restriction_query’!

user_custom_values:

  • Sets a Hash of initial custom values for the new user

Optionally, you can also set custom values for the contact which is created on the invited organization, if that organization is a “managed” organization.

invited_contact_custom_values:

  • Sets a Hash of initial custom values for the contact object on the invited organization.

NOTE: The contact created on the inviting organization will always use the ‘organization_custom_values’ as custom values!

# File services.rb, line 1655
def invite_organization email_address, invitation_type, opts = {}

  organization_name = PIM.get_value(opts, :organization_name, :organizationName)
  organization_custom_id = PIM.get_value(opts, :organization_custom_id, :organizationCustomId)
  organization_custom_values = PIM.get_value(opts, :organization_custom_values, :organizationCustomValues, :custom_values, :customValues)

  user_roles = PIM.get_value(opts, :user_roles, :roles)
  user_restriction_filter = PIM.get_value(opts, :user_restriction_filter, :userRestrictionFilter)
  user_restriction_query = PIM.get_value(opts, :user_restriction_query, :userRestrictionQuery)
  user_custom_values = PIM.get_value(opts, :user_custom_values, :userCustomValues)

  invited_contact_custom_values = PIM.get_value(opts, :invited_contact_custom_values, :invitedContactCustomValues)

  language = PIM.get_value(opts, :language)

  __invitation_service.inviteOrganization(email_address,
                                          invitation_type,
                                          organization_name,
                                          organization_custom_id,
                                          PIM.javaify_hash(organization_custom_values),
                                          user_roles,
                                          user_restriction_filter,
                                          user_restriction_query,
                                          PIM.javaify_hash(user_custom_values),
                                          PIM.javaify_hash(invited_contact_custom_values),
                                          language)
end