Module: Infopark::Crm

Defined in:
lib/crm_connector.rb,
lib/crm_connector.rb,
lib/crm_connector/core.rb,
lib/crm_connector/role.rb,
lib/crm_connector/event.rb,
lib/crm_connector/errors.rb,
lib/crm_connector/system.rb,
lib/crm_connector/account.rb,
lib/crm_connector/contact.rb,
lib/crm_connector/mailing.rb,
lib/crm_connector/activity.rb,
lib/crm_connector/attachment.rb,
lib/crm_connector/custom_type.rb,
lib/crm_connector/errors/base.rb,
lib/crm_connector/configuration.rb,
lib/crm_connector/core/resource.rb,
lib/crm_connector/event_contact.rb,
lib/crm_connector/core/enumerator.rb,
lib/crm_connector/core/search_support.rb,
lib/crm_connector/core/known_attributes.rb,
lib/crm_connector/core/continuation_support.rb,
lib/crm_connector/errors/authentication_failed.rb

Defined Under Namespace

Modules: Core, Errors Classes: Account, Activity, Attachment, Contact, CustomType, Event, EventContact, Mailing, Role, System

Class Method Summary collapse

Class Method Details

.configure {|Configuration| ... }

This method returns an undefined value.

Configures the web services connection

View README for a usage example.

Supported configuration keys are:

url

The web services server url (schema, host, port, path (up to, but not including /api)).

login

The user name (login) of the WebCRM contact person.

api_key

The WebCRM user's valid API key (web services credential).

locale

The locale to use when sending requests to the server. Can be redefined at any time.

Example:

Infopark::Crm.configure do |configuration|
  configuration.locale = I18n.locale
end

Infopark::Crm::Contact.create.errors.full_messages
live_server_groups_callback

A custom definition of what a contact's live_server_groups field returns. Provide a lambda that takes the contact instance as an argument and returns an array of live_server_groups (strings).

Example:

Infopark::Crm.configure do |configuration|
  configuration.live_server_groups_callback = lambda {|contact|
    case contact..name
    when "MyCompany"
      %w(admin reader writer)
    else
      %w(reader)
    end
  }
end

Yields:

  • (Configuration)

62
63
64
65
66
# File 'lib/crm_connector.rb', line 62

def self.configure(&block)
  yield Configuration

  Core::Resource.configure(Configuration)
end