This Gem provides connection to the Raynet.cz REST API.
Add this line to your application's Gemfile:
gem 'raynet'
Create file in config/initializers/raynet.rb with this content:
Raynet::Config.config = {
user: '[email protected]', # email of CRM user with API rights
api_key: 'crm-be5e87cf4d0d4b18a9ed9eeXXXXXXX', # API key you have generated
instance_name: 'my_app' # your instance name
}
Or you can generate this config file by running rails generate raynet
in console.
com = Raynet::Companies.new # initialize Companies connector
com.list({'limit' => 10, 'name[LIKE]' => 'Google'}) # return list of Companies
# creating:
data = {
'name' => 'John Doe',
'person' => true,
'firstName' => 'John',
'lastName' => 'Doe',
'role' => 'B_PARTNER',
'notice' => '[email protected]',
'rating' => 'A',
'state' => 'A_POTENTIAL'
}
com.create(data) # creates new Company
bc = Raynet::BusinessCases.new # initialize Business cases connector
bc.list({'limit' => 10, 'name[LIKE]' => 'RAY%'}) # return list of Business cases
# creating:
data = {
'company' => 103,
'name' => "First BC",
'totalAmount' => 1000,
'validFrom' => '2018-01-30',
'description' => 'Some text'
}
bc.create(data) # creates new Business case
lead = Raynet::Leads.new # initialize Lead connector
lead.list({'limit' => 10, 'name[LIKE]' => 'Google'}) # return list of Leads
# creating:
data = {
'topic' => 'Message topic',
'priority' => 'DEFAULT',
'companyName' => 'John Doe',
'notice' => 'Some text',
'contactInfo' => {
'email' => '[email protected]'
}
}
lead.create(data) # creates new Lead
See more data examples at https://s3-eu-west-1.amazonaws.com/static-raynet/webroot/api-doc.html
Richard Lapiš