raynet 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +88 -0
- data/lib/generators/raynet_generator.rb +11 -0
- data/lib/raynet.rb +18 -0
- data/lib/raynet/business_cases.rb +13 -0
- data/lib/raynet/companies.rb +13 -0
- data/lib/raynet/core.rb +21 -0
- data/lib/raynet/engine.rb +4 -0
- data/lib/raynet/leads.rb +13 -0
- data/lib/raynet/version.rb +3 -0
- data/lib/templates/raynet/raynet_template.rb +5 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f832e1e739f058aa395252b957272b6767cb17f
|
4
|
+
data.tar.gz: 1cfe3c216d8d05dcbd409407430953fe55a1af9b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a476a756315e0b1d2950e00cef66fa8a4dc34a82124a922247001d85b3270a68daa5d4690f89726c241bc700e0088ab80dbe9ea5cfef60a02dad109b1e9576a3
|
7
|
+
data.tar.gz: c17ba1f7035fc3ebfb595d8f31110e54fba9324d543009aba33d8269492a30c4e548775a3cc366ca09b1bc354f96ad2852df526aee71665178863fd49b84cd23
|
data/README.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Raynet CRM
|
2
|
+
|
3
|
+
This Gem provides connection to the Raynet.cz REST API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'raynet'
|
10
|
+
```
|
11
|
+
|
12
|
+
## Configuration
|
13
|
+
|
14
|
+
Create file in config/initializers/raynet.rb with this content:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
Raynet::Config.config = {
|
18
|
+
user: 'some_email@example.org', # email of CRM user with API rights
|
19
|
+
api_key: 'crm-be5e87cf4d0d4b18a9ed9eeXXXXXXX', # API key you have generated
|
20
|
+
instance_name: 'my_app' # your instance name
|
21
|
+
}
|
22
|
+
```
|
23
|
+
|
24
|
+
Or you can generate this config file by running ```rails generate raynet``` in console.
|
25
|
+
|
26
|
+
## Using
|
27
|
+
|
28
|
+
#### Companies
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
com = Raynet::Companies.new # initialize Companies connector
|
32
|
+
com.list({'limit' => 10, 'name[LIKE]' => 'Google'}) # return list of Companies
|
33
|
+
|
34
|
+
# creating:
|
35
|
+
data = {
|
36
|
+
'name' => 'John Doe',
|
37
|
+
'person' => true,
|
38
|
+
'firstName' => 'John',
|
39
|
+
'lastName' => 'Doe',
|
40
|
+
'role' => 'B_PARTNER',
|
41
|
+
'notice' => 'some@example.org',
|
42
|
+
'rating' => 'A',
|
43
|
+
'state' => 'A_POTENTIAL'
|
44
|
+
}
|
45
|
+
com.create(data) # creates new Company
|
46
|
+
```
|
47
|
+
|
48
|
+
#### Business cases
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
bc = Raynet::BusinessCases.new # initialize Business cases connector
|
52
|
+
bc.list({'limit' => 10, 'name[LIKE]' => 'RAY%'}) # return list of Business cases
|
53
|
+
|
54
|
+
# creating:
|
55
|
+
data = {
|
56
|
+
'company' => 103,
|
57
|
+
'name' => "First BC",
|
58
|
+
'totalAmount' => 1000,
|
59
|
+
'validFrom' => '2018-01-30',
|
60
|
+
'description' => 'Some text'
|
61
|
+
}
|
62
|
+
bc.create(data) # creates new Business case
|
63
|
+
```
|
64
|
+
|
65
|
+
#### Leads
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
lead = Raynet::Leads.new # initialize Lead connector
|
69
|
+
lead.list({'limit' => 10, 'name[LIKE]' => 'Google'}) # return list of Leads
|
70
|
+
|
71
|
+
# creating:
|
72
|
+
data = {
|
73
|
+
'topic' => 'Message topic',
|
74
|
+
'priority' => 'DEFAULT',
|
75
|
+
'companyName' => 'John Doe',
|
76
|
+
'notice' => 'Some text',
|
77
|
+
'contactInfo' => {
|
78
|
+
'email' => 'some@example.org'
|
79
|
+
}
|
80
|
+
}
|
81
|
+
lead.create(data) # creates new Lead
|
82
|
+
```
|
83
|
+
|
84
|
+
See more data examples at `https://s3-eu-west-1.amazonaws.com/static-raynet/webroot/api-doc.html`
|
85
|
+
|
86
|
+
## Author
|
87
|
+
|
88
|
+
Richard Lapiš
|
@@ -0,0 +1,11 @@
|
|
1
|
+
if defined?(Rails)
|
2
|
+
|
3
|
+
# Rails3 generator invoked with 'rails generate raynet'
|
4
|
+
class RaynetGenerator < Rails::Generators::Base
|
5
|
+
source_root(File.expand_path(File.dirname(__FILE__) + "/../templates/raynet"))
|
6
|
+
def copy_initializer
|
7
|
+
copy_file 'raynet_template.rb', 'config/initializers/raynet.rb'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/lib/raynet.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Raynet
|
2
|
+
require 'raynet/version'
|
3
|
+
require 'raynet/engine' if defined?(::Rails)
|
4
|
+
require 'raynet/core'
|
5
|
+
require 'raynet/companies'
|
6
|
+
require 'raynet/business_cases'
|
7
|
+
require 'raynet/leads'
|
8
|
+
|
9
|
+
class Config
|
10
|
+
@@config = {}
|
11
|
+
cattr_accessor :config
|
12
|
+
|
13
|
+
def initialize(opts = {})
|
14
|
+
@opts = opts
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Raynet
|
2
|
+
class BusinessCases < Core
|
3
|
+
|
4
|
+
def list(data)
|
5
|
+
data['limit'] ||= 1000
|
6
|
+
request(method: :get, endpoint: "businessCase", data: data)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create(data)
|
10
|
+
request(method: :put, endpoint: "businessCase", data: data)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/raynet/core.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Raynet
|
2
|
+
class Core
|
3
|
+
|
4
|
+
def request(params = {})
|
5
|
+
req = RestClient::Request.new(
|
6
|
+
method: params[:method],
|
7
|
+
url: "https://app.raynet.cz/api/v2/#{params[:endpoint]}",
|
8
|
+
user: Raynet::Config.config[:user],
|
9
|
+
password: Raynet::Config.config[:api_key],
|
10
|
+
headers: headers,
|
11
|
+
payload: params[:data].to_json
|
12
|
+
).execute
|
13
|
+
|
14
|
+
JSON.parse(req, symbolize_keys: true)
|
15
|
+
end
|
16
|
+
|
17
|
+
def headers
|
18
|
+
{'X-Instance-Name' => Raynet::Config.config[:instance_name], accept: :json, content_type: :json}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/raynet/leads.rb
ADDED
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raynet
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Lapiš
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.7.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.7.3
|
27
|
+
description: raynet.cz application REST API gem
|
28
|
+
email: richard.lapis@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- README.md
|
34
|
+
- lib/generators/raynet_generator.rb
|
35
|
+
- lib/raynet.rb
|
36
|
+
- lib/raynet/business_cases.rb
|
37
|
+
- lib/raynet/companies.rb
|
38
|
+
- lib/raynet/core.rb
|
39
|
+
- lib/raynet/engine.rb
|
40
|
+
- lib/raynet/leads.rb
|
41
|
+
- lib/raynet/version.rb
|
42
|
+
- lib/templates/raynet/raynet_template.rb
|
43
|
+
homepage: https://github.com/richardrails/raynet
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 2.2.0
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.4.8
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: raynet.cz application REST API gem
|
67
|
+
test_files: []
|