sellsy-client 0.5.0 → 0.10.0
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/sellsy/contact.rb +50 -3
- data/lib/sellsy/custom_field.rb +2 -2
- data/lib/sellsy/customer.rb +3 -2
- data/lib/sellsy/opportunity.rb +1 -1
- data/lib/sellsy/prospect.rb +2 -0
- data/lib/sellsy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca7907749f9d9b1df1865191066f068ad034f471ef17f8fb0022db589ca16e9f
|
4
|
+
data.tar.gz: c9e87eff0a1001e83da3355dcd7ceaa47ca11ca3c825229dcf11f971757eef12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1523e05af6cb3759eaad5afdd690f537fd20615e218451bc2989c8430b433f81a8669e1e9c2bc2602c195823450d27553b1264730bc2d8732052aaf5387aed
|
7
|
+
data.tar.gz: 8197ebf9ab4d1938ce0550a9d95a687d3a43961086d2f139a47e996080877030e1d2367bbd6b51e2df4bd4ab91a0102101337f2b51cf038638c9a35b999b42a0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sellsy-client (0.
|
4
|
+
sellsy-client (0.9.0)
|
5
5
|
multi_json (~> 1.11)
|
6
6
|
rest-client (~> 2.0, >= 2.0.2)
|
7
7
|
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
netrc (~> 0.8)
|
28
28
|
unf (0.1.4)
|
29
29
|
unf_ext
|
30
|
-
unf_ext (0.0.7.
|
30
|
+
unf_ext (0.0.7.7)
|
31
31
|
|
32
32
|
PLATFORMS
|
33
33
|
ruby
|
data/lib/sellsy/contact.rb
CHANGED
@@ -2,8 +2,8 @@ require 'multi_json'
|
|
2
2
|
|
3
3
|
module Sellsy
|
4
4
|
class Contact
|
5
|
-
attr_accessor :id, :title, :name, :first_name, :last_name, :
|
6
|
-
:role, :birth_date
|
5
|
+
attr_accessor :id, :title, :name, :first_name, :last_name, :third_ids, :email, :telephone, :mobile, :fax, :website,
|
6
|
+
:role, :birth_date, :linked_type, :linked_id
|
7
7
|
|
8
8
|
def create
|
9
9
|
command = {
|
@@ -20,6 +20,19 @@ module Sellsy
|
|
20
20
|
response['status'] == 'success'
|
21
21
|
end
|
22
22
|
|
23
|
+
def update
|
24
|
+
command = {
|
25
|
+
'method' => 'Peoples.update',
|
26
|
+
'params' => {
|
27
|
+
'id' => @id,
|
28
|
+
'people' => to_params
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
response = MultiJson.load(Sellsy::Api.request command)
|
33
|
+
response['status'] == 'success'
|
34
|
+
end
|
35
|
+
|
23
36
|
def self.find(people_id)
|
24
37
|
command = {
|
25
38
|
'method' => 'Peoples.getOne',
|
@@ -58,6 +71,40 @@ module Sellsy
|
|
58
71
|
contact
|
59
72
|
end
|
60
73
|
|
74
|
+
def self.search(name, b_date = nil)
|
75
|
+
contacts = []
|
76
|
+
|
77
|
+
unless name.blank?
|
78
|
+
command = {
|
79
|
+
'method' => 'Peoples.getList',
|
80
|
+
'params' => {
|
81
|
+
'search' => {
|
82
|
+
'contains' => name,
|
83
|
+
'birthdate' => b_date.blank? ? nil : Date.parse(b_date).to_datetime.to_i,
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
response = MultiJson.load(Sellsy::Api.request command)
|
89
|
+
|
90
|
+
if response['response']
|
91
|
+
response['response']['result'].each do |key, value|
|
92
|
+
contact = Contact.new
|
93
|
+
contact.id = key
|
94
|
+
contact.linked_type = value['linkedtype']
|
95
|
+
contact.linked_id = value['linkedid']
|
96
|
+
contact.name = value['name']
|
97
|
+
contact.first_name = value['forename']
|
98
|
+
contact.email = value['email']
|
99
|
+
contact.third_ids = ((value['prospectList'] || []) + (value['thirdList'] || []) + (value['supplierList'] || [])).map {|e| e['id']}
|
100
|
+
contacts << contact
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
contacts
|
106
|
+
end
|
107
|
+
|
61
108
|
def to_params
|
62
109
|
{
|
63
110
|
'civil' => civil_enum(@title),
|
@@ -70,7 +117,7 @@ module Sellsy
|
|
70
117
|
'web' => @website,
|
71
118
|
'position' => @role,
|
72
119
|
'birthdate' => @birth_date.blank? ? '' : Date.parse(@birth_date).to_datetime.to_i,
|
73
|
-
'thirdids' => @
|
120
|
+
'thirdids' => @third_ids.blank? ? nil : @third_ids
|
74
121
|
}
|
75
122
|
end
|
76
123
|
|
data/lib/sellsy/custom_field.rb
CHANGED
data/lib/sellsy/customer.rb
CHANGED
@@ -29,7 +29,7 @@ module Sellsy
|
|
29
29
|
|
30
30
|
def to_params
|
31
31
|
{
|
32
|
-
'
|
32
|
+
'clientid' => @id,
|
33
33
|
'third' => {
|
34
34
|
'name' => person_type == 'pp' ? @name : @structure_name,
|
35
35
|
'type' => person_type == 'pp' ? 'person' : 'corporation',
|
@@ -61,7 +61,6 @@ module Sellsy
|
|
61
61
|
value = response['response']['client']
|
62
62
|
client.id = value['id']
|
63
63
|
client.name = value['name']
|
64
|
-
client.type = value['type']
|
65
64
|
client.contacts = response['response']['contacts']
|
66
65
|
end
|
67
66
|
|
@@ -82,6 +81,8 @@ module Sellsy
|
|
82
81
|
client = Customer.new
|
83
82
|
client.id = key
|
84
83
|
client.name = value['fullName']
|
84
|
+
client.email = value['email']
|
85
|
+
client.siret = value['siret']
|
85
86
|
clients << client
|
86
87
|
end
|
87
88
|
end
|
data/lib/sellsy/opportunity.rb
CHANGED
data/lib/sellsy/prospect.rb
CHANGED
data/lib/sellsy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sellsy-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Stammers
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: multi_json
|