JustRelate WebCRM is a cloud-based CRM. The JustRelate WebCRM SDK makes CRM content available to your Ruby application. It is a client of the JustRelate WebCRM REST API v2.
This SDK lets you access and manipulate accounts and contacts, for example, perform searches, etc.
Add infopark_webcrm_sdk
to your Gemfile
:
gem 'infopark_webcrm_sdk'
Install the gem with Bundler:
bundle install
require 'infopark_webcrm_sdk'
Crm.configure do |config|
config.tenant = 'my_tenant'
config.login = 'my_login'
config.api_key = 'my_api_key'
end
The documentation is available at RubyDoc.info.
The JustRelate WebCRM SDK provides the following JustRelate WebCRM resources to your Ruby application:
- {Crm::Account}
- {Crm::Activity}
- {Crm::Collection}
- {Crm::Contact}
- {Crm::EventContact}
- {Crm::Event}
- {Crm::Mailing}
- {Crm::MailingDelivery}
- {Crm::TemplateSet}
- {Crm::Type}
Most of these classes have methods such as {Crm::Core::Mixins::Findable::ClassMethods#find find}, {Crm::Core::Mixins::Modifiable::ClassMethods#create create}, {Crm::Core::Mixins::Modifiable#update update}, {Crm::Core::Mixins::Searchable::ClassMethods#query query}, and {Crm::Core::Mixins::Searchable::ClassMethods#where where}.
contact = Crm::Contact.create({
first_name: 'John',
last_name: 'Smith',
language: 'en',
locality: 'New York',
})
# => Crm::Contact
contact.first_name
# => 'John'
contact.id
# => 'e70a7123f499c5e0e9972ab4dbfb8fe3'
# Retrieve the contact by ID
contact = Crm::Contact.find('e70a7123f499c5e0e9972ab4dbfb8fe3')
# => Crm::Contact
contact.last_name
# => 'Smith'
contact.locality
# => 'New York'
# Change this contact's locality
contact.update({locality: 'Boston'})
# => Crm::Contact
contact.last_name
# => 'Smith'
contact.locality
# => 'Boston'
Crm::Contact.where(:login, :equals, 'root').first
# => Crm::Contact
Crm::Contact.where(:locality, :equals, 'Boston').
and(:last_name, :contains_word_prefixes, 'S').
sort_by(:last_name).
sort_order(:desc).
limit(2).
map(&:last_name)
# => ['Smith', 'Simpson']
Copyright (c) 2015 - 2024 JustRelate Group GmbH.
This software can be used and modified in accordance with the MIT license. Please refer to LICENSE for details.