amorail 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rubocop.yml +61 -0
  4. data/.travis.yml +9 -0
  5. data/Gemfile +5 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +245 -0
  8. data/Rakefile +15 -0
  9. data/amorail.gemspec +33 -0
  10. data/lib/amorail.rb +49 -0
  11. data/lib/amorail/client.rb +101 -0
  12. data/lib/amorail/config.rb +17 -0
  13. data/lib/amorail/entities/company.rb +23 -0
  14. data/lib/amorail/entities/contact.rb +29 -0
  15. data/lib/amorail/entities/contact_link.rb +32 -0
  16. data/lib/amorail/entities/elementable.rb +37 -0
  17. data/lib/amorail/entities/lead.rb +26 -0
  18. data/lib/amorail/entities/leadable.rb +29 -0
  19. data/lib/amorail/entities/note.rb +17 -0
  20. data/lib/amorail/entities/task.rb +18 -0
  21. data/lib/amorail/entities/webhook.rb +42 -0
  22. data/lib/amorail/entity.rb +128 -0
  23. data/lib/amorail/entity/finders.rb +67 -0
  24. data/lib/amorail/entity/params.rb +95 -0
  25. data/lib/amorail/entity/persistence.rb +66 -0
  26. data/lib/amorail/exceptions.rb +25 -0
  27. data/lib/amorail/property.rb +130 -0
  28. data/lib/amorail/railtie.rb +8 -0
  29. data/lib/amorail/version.rb +4 -0
  30. data/lib/tasks/amorail.rake +6 -0
  31. data/spec/client_spec.rb +123 -0
  32. data/spec/company_spec.rb +82 -0
  33. data/spec/contact_link_spec.rb +40 -0
  34. data/spec/contact_spec.rb +187 -0
  35. data/spec/entity_spec.rb +55 -0
  36. data/spec/fixtures/accounts/response_1.json +344 -0
  37. data/spec/fixtures/accounts/response_2.json +195 -0
  38. data/spec/fixtures/amorail_test.yml +3 -0
  39. data/spec/fixtures/contacts/create.json +13 -0
  40. data/spec/fixtures/contacts/find_many.json +57 -0
  41. data/spec/fixtures/contacts/find_one.json +41 -0
  42. data/spec/fixtures/contacts/links.json +16 -0
  43. data/spec/fixtures/contacts/my_contact_find.json +47 -0
  44. data/spec/fixtures/contacts/update.json +13 -0
  45. data/spec/fixtures/leads/create.json +13 -0
  46. data/spec/fixtures/leads/find_many.json +73 -0
  47. data/spec/fixtures/leads/links.json +16 -0
  48. data/spec/fixtures/leads/update.json +13 -0
  49. data/spec/fixtures/leads/update_errors.json +12 -0
  50. data/spec/fixtures/webhooks/list.json +24 -0
  51. data/spec/fixtures/webhooks/subscribe.json +17 -0
  52. data/spec/fixtures/webhooks/unsubscribe.json +17 -0
  53. data/spec/helpers/webmock_helpers.rb +279 -0
  54. data/spec/lead_spec.rb +101 -0
  55. data/spec/my_contact_spec.rb +48 -0
  56. data/spec/note_spec.rb +26 -0
  57. data/spec/property_spec.rb +45 -0
  58. data/spec/spec_helper.rb +20 -0
  59. data/spec/support/elementable_example.rb +52 -0
  60. data/spec/support/entity_class_example.rb +15 -0
  61. data/spec/support/leadable_example.rb +33 -0
  62. data/spec/support/my_contact.rb +3 -0
  63. data/spec/support/my_entity.rb +4 -0
  64. data/spec/task_spec.rb +49 -0
  65. data/spec/webhook_spec.rb +59 -0
  66. metadata +319 -0
@@ -0,0 +1,82 @@
1
+ require "spec_helper"
2
+
3
+ describe Amorail::Company do
4
+ before { mock_api }
5
+
6
+ describe "validations" do
7
+ it { should validate_presence_of(:name) }
8
+ end
9
+
10
+ describe ".attributes" do
11
+ subject { described_class.attributes }
12
+
13
+ it_behaves_like 'entity_class'
14
+
15
+ specify { is_expected.to include(:name) }
16
+ end
17
+
18
+ describe ".properties" do
19
+ subject { described_class.properties }
20
+
21
+ specify { is_expected.to include(:email, :phone, :web, :address) }
22
+ end
23
+
24
+ describe "#params" do
25
+ let(:company) do
26
+ described_class.new(
27
+ name: 'Test inc',
28
+ phone: '12345678',
29
+ email: 'test@mala.ru',
30
+ address: '10, State st',
31
+ web: 'hoohle.com'
32
+ )
33
+ end
34
+
35
+ subject { company.params }
36
+
37
+ specify { is_expected.to include(:last_modified) }
38
+ specify { is_expected.to include(name: 'Test inc') }
39
+ specify { is_expected.to include(type: 'contact') }
40
+
41
+ it "contains email property" do
42
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460591" }
43
+ expect(prop).not_to be_nil
44
+ expect(prop[:values].first[:value]).to eq 'test@mala.ru'
45
+ expect(prop[:values].first[:enum])
46
+ .to eq described_class.properties[:email][:enum]
47
+ end
48
+
49
+ it "contains phone property" do
50
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460589" }
51
+ expect(prop).not_to be_nil
52
+ expect(prop[:values].first[:value]).to eq '12345678'
53
+ expect(prop[:values].first[:enum])
54
+ .to eq described_class.properties[:phone][:enum]
55
+ end
56
+
57
+ it "contains address property" do
58
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460597" }
59
+ expect(prop).not_to be_nil
60
+ expect(prop[:values].first[:value]).to eq '10, State st'
61
+ end
62
+
63
+ it "contains web property" do
64
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460593" }
65
+ expect(prop).not_to be_nil
66
+ expect(prop[:values].first[:value]).to eq 'hoohle.com'
67
+ end
68
+
69
+ it_behaves_like 'leadable'
70
+ end
71
+
72
+ describe "#save" do
73
+ let(:company) { described_class.new(name: "test") }
74
+
75
+ before { company_create_stub(Amorail.config.api_endpoint) }
76
+
77
+ it "should set id after create" do
78
+ company.save!
79
+ expect(company.id).to eq 101
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ describe Amorail::ContactLink do
4
+ before { mock_api }
5
+
6
+ describe ".attributes" do
7
+ subject { described_class.attributes }
8
+
9
+ it_behaves_like 'entity_class'
10
+
11
+ specify do
12
+ is_expected.to include(
13
+ :contact_id,
14
+ :lead_id
15
+ )
16
+ end
17
+ end
18
+
19
+ describe ".find_by_leads" do
20
+ before { leads_links_stub(Amorail.config.api_endpoint, [2]) }
21
+
22
+ it "returns list of contact links" do
23
+ res = described_class.find_by_leads(2)
24
+ expect(res.size).to eq 2
25
+ expect(res.first.contact_id).to eq "101"
26
+ expect(res.last.contact_id).to eq "102"
27
+ end
28
+ end
29
+
30
+ describe ".find_by_contacts" do
31
+ before { contacts_links_stub(Amorail.config.api_endpoint, [101]) }
32
+
33
+ it "returns list of contact links" do
34
+ res = described_class.find_by_contacts(101)
35
+ expect(res.size).to eq 2
36
+ expect(res.first.lead_id).to eq "1"
37
+ expect(res.last.lead_id).to eq "2"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,187 @@
1
+ require "spec_helper"
2
+
3
+ describe Amorail::Contact do
4
+ before { mock_api }
5
+
6
+ let(:contact) { described_class.new(name: "test") }
7
+
8
+ describe "validations" do
9
+ it { should validate_presence_of(:name) }
10
+ end
11
+
12
+ describe ".attributes" do
13
+ subject { described_class.attributes }
14
+
15
+ it_behaves_like 'entity_class'
16
+
17
+ specify { is_expected.to include(:name, :company_name) }
18
+ end
19
+
20
+ describe ".properties" do
21
+ subject { described_class.properties }
22
+
23
+ specify { is_expected.to include(:email, :phone, :position) }
24
+ end
25
+
26
+ describe "#params" do
27
+ let(:contact) do
28
+ described_class.new(
29
+ name: 'Tester',
30
+ company_name: 'Test inc',
31
+ linked_company_id: 123,
32
+ phone: '12345678',
33
+ email: 'test@mala.ru',
34
+ position: 'CEO'
35
+ )
36
+ end
37
+
38
+ subject { contact.params }
39
+
40
+ specify { is_expected.to include(:last_modified) }
41
+ specify { is_expected.to include(name: 'Tester') }
42
+ specify { is_expected.to include(company_name: 'Test inc') }
43
+ specify { is_expected.to include(linked_company_id: 123) }
44
+
45
+ it "contains email property" do
46
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460591" }
47
+ expect(prop).not_to be_nil
48
+ expect(prop[:values].first[:value]).to eq 'test@mala.ru'
49
+ expect(prop[:values].first[:enum])
50
+ .to eq described_class.properties[:email][:enum]
51
+ end
52
+
53
+ it "contains phone property" do
54
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460589" }
55
+ expect(prop).not_to be_nil
56
+ expect(prop[:values].first[:value]).to eq '12345678'
57
+ expect(prop[:values].first[:enum])
58
+ .to eq described_class.properties[:phone][:enum]
59
+ end
60
+
61
+ it "contains position property" do
62
+ prop = subject[:custom_fields].detect { |p| p[:id] == "1460587" }
63
+ expect(prop).not_to be_nil
64
+ expect(prop[:values].first[:value]).to eq 'CEO'
65
+ end
66
+
67
+ it_behaves_like 'leadable'
68
+ end
69
+
70
+ describe ".find" do
71
+ before { contact_find_stub(Amorail.config.api_endpoint, 101) }
72
+ before { contact_find_stub(Amorail.config.api_endpoint, 102, false) }
73
+
74
+ it "loads entity" do
75
+ obj = described_class.find(101)
76
+ expect(obj.id).to eq 101
77
+ expect(obj.company_name).to eq "Foo Inc."
78
+ expect(obj.email).to eq "foo@tb.com"
79
+ expect(obj.phone).to eq "1111 111 111"
80
+ expect(obj.params[:id]).to eq 101
81
+ expect(obj.linked_leads_id).to contain_exactly("1872746", "1885024")
82
+ end
83
+
84
+ it "returns nil" do
85
+ obj = described_class.find(102)
86
+ expect(obj).to be_nil
87
+ end
88
+
89
+ it "raise error" do
90
+ expect { described_class.find!(102) }
91
+ .to raise_error(Amorail::Entity::RecordNotFound)
92
+ end
93
+ end
94
+
95
+ describe ".find_by_query" do
96
+ before { contacts_find_query_stub(Amorail.config.api_endpoint, 'foo') }
97
+ before { contacts_find_query_stub(Amorail.config.api_endpoint, 'faa', nil) }
98
+
99
+ it "loads entities" do
100
+ res = described_class.find_by_query('foo')
101
+ expect(res.size).to eq 2
102
+ expect(res.first.id).to eq 101
103
+ expect(res.last.id).to eq 102
104
+ expect(res.first.company_name).to eq "Foo Inc."
105
+ expect(res.last.email).to eq "foo2@tb.com"
106
+ expect(res.first.phone).to eq "1111 111 111"
107
+ expect(res.first.params[:id]).to eq 101
108
+ end
109
+
110
+ it "returns empty array" do
111
+ res = described_class.find_by_query('faa')
112
+ expect(res).to be_a(Array)
113
+ expect(res).to be_empty
114
+ end
115
+ end
116
+
117
+ describe ".find_all" do
118
+ before { contacts_find_all_stub(Amorail.config.api_endpoint, [101, 102]) }
119
+ before { contacts_find_all_stub(Amorail.config.api_endpoint, [105, 104], false) }
120
+
121
+ it "loads entities" do
122
+ res = described_class.find_all(101, 102)
123
+ expect(res.size).to eq 2
124
+ expect(res.first.id).to eq 101
125
+ expect(res.last.id).to eq 102
126
+ expect(res.first.company_name).to eq "Foo Inc."
127
+ expect(res.last.email).to eq "foo2@tb.com"
128
+ expect(res.first.phone).to eq "1111 111 111"
129
+ expect(res.first.params[:id]).to eq 101
130
+ end
131
+
132
+ it "returns empty array" do
133
+ res = described_class.find_all([105, 104])
134
+ expect(res).to be_a(Array)
135
+ expect(res).to be_empty
136
+ end
137
+ end
138
+
139
+ describe ".where" do
140
+ before { contacts_where_stub(Amorail.config.api_endpoint, query: 'xxx', limit_rows: 10, limit_offset: 100) }
141
+
142
+ it "loads entities" do
143
+ res = described_class.where(query: 'xxx', limit_rows: 10, limit_offset: 100)
144
+ expect(res.size).to eq 2
145
+ expect(res.first.id).to eq 101
146
+ expect(res.last.id).to eq 102
147
+ expect(res.first.company_name).to eq "Foo Inc."
148
+ expect(res.last.email).to eq "foo2@tb.com"
149
+ expect(res.first.phone).to eq "1111 111 111"
150
+ expect(res.first.params[:id]).to eq 101
151
+ end
152
+ end
153
+
154
+ describe "#save" do
155
+ before { contact_create_stub(Amorail.config.api_endpoint) }
156
+
157
+ it "set id after create" do
158
+ contact.save!
159
+ expect(contact.id).to eq 101
160
+ end
161
+ end
162
+
163
+ describe "#update" do
164
+ before { contact_create_stub(Amorail.config.api_endpoint) }
165
+
166
+ it "update params" do
167
+ contact.save!
168
+ contact.name = "foo"
169
+
170
+ contact_update_stub(Amorail.config.api_endpoint)
171
+ expect(contact.save!).to be_truthy
172
+ expect(contact.name).to eq "foo"
173
+ end
174
+
175
+ it "raise error if id is blank?" do
176
+ obj = described_class.new
177
+ expect { obj.update!(name: 'Igor') }
178
+ .to raise_error(Amorail::Entity::NotPersisted)
179
+ end
180
+
181
+ it "raise error" do
182
+ obj = described_class.new
183
+ expect { obj.update!(id: 101, name: "Igor") }
184
+ .to(raise_error(Amorail::Entity::NotPersisted))
185
+ end
186
+ end
187
+ end
@@ -0,0 +1,55 @@
1
+ require "spec_helper"
2
+
3
+ describe MyEntity do
4
+ before { mock_api }
5
+
6
+ let(:entity) { described_class.new }
7
+
8
+ it_behaves_like 'entity_class'
9
+
10
+ describe "#params" do
11
+ let(:now) { Time.now }
12
+
13
+ subject { entity.params }
14
+
15
+ specify { is_expected.to include(:last_modified) }
16
+ specify {
17
+ is_expected.not_to include(
18
+ :id, :request_id, :responsible_user_id, :date_create)
19
+ }
20
+
21
+ context "with some values" do
22
+ let(:entity) do
23
+ described_class.new(
24
+ responsible_user_id: 2,
25
+ last_modified: now
26
+ )
27
+ end
28
+
29
+ specify { is_expected.to include(responsible_user_id: 2) }
30
+ specify { is_expected.to include(last_modified: now.to_i) }
31
+ specify {
32
+ is_expected.not_to include(
33
+ :id, :request_id, :date_create)
34
+ }
35
+ end
36
+
37
+ context "with all values" do
38
+ let(:entity) do
39
+ described_class.new(
40
+ id: 100,
41
+ request_id: 1,
42
+ responsible_user_id: 2,
43
+ date_create: now,
44
+ last_modified: now
45
+ )
46
+ end
47
+
48
+ specify { is_expected.to include(id: 100) }
49
+ specify { is_expected.to include(request_id: 1) }
50
+ specify { is_expected.to include(responsible_user_id: 2) }
51
+ specify { is_expected.to include(date_create: now.to_i) }
52
+ specify { is_expected.to include(last_modified: now.to_i) }
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,344 @@
1
+ {
2
+ "response": {
3
+ "account": {
4
+ "id": "8195968",
5
+ "name": "База клиентов",
6
+ "subdomain": "test",
7
+ "currency": "RUB",
8
+ "paid_from": false,
9
+ "paid_till": false,
10
+ "timezone": "Europe/Moscow",
11
+ "language": "ru",
12
+ "date_pattern": "d.m.Y H:i",
13
+ "limits": {
14
+ "users_count": false,
15
+ "contacts_count": false,
16
+ "active_deals_count": false
17
+ },
18
+ "users": [
19
+ {
20
+ "id": "337914",
21
+ "name": "sergey",
22
+ "last_name": null,
23
+ "login": "alekseenkoss@gmail.com",
24
+ "group_id": 0,
25
+ "rights_lead_add": "A",
26
+ "rights_lead_view": "A",
27
+ "rights_lead_edit": "A",
28
+ "rights_lead_delete": "A",
29
+ "rights_lead_export": "A",
30
+ "rights_contact_add": "A",
31
+ "rights_contact_view": "A",
32
+ "rights_contact_edit": "A",
33
+ "rights_contact_delete": "A",
34
+ "rights_contact_export": "A",
35
+ "rights_company_add": "A",
36
+ "rights_company_view": "A",
37
+ "rights_company_edit": "A",
38
+ "rights_company_delete": "A",
39
+ "rights_company_export": "A",
40
+ "is_admin": "Y"
41
+ }
42
+ ],
43
+ "groups": [],
44
+ "leads_statuses": [
45
+ {
46
+ "name": "Первичный контакт",
47
+ "id": "8195972",
48
+ "color": "#99CCFF",
49
+ "editable": "Y",
50
+ "sort": "10"
51
+ },
52
+ {
53
+ "name": "Переговоры",
54
+ "id": "8195974",
55
+ "color": "#FFFF99",
56
+ "editable": "Y",
57
+ "sort": "20"
58
+ },
59
+ {
60
+ "name": "Принимают решение",
61
+ "id": "8195976",
62
+ "color": "#FFCC66",
63
+ "editable": "Y",
64
+ "sort": "30"
65
+ },
66
+ {
67
+ "name": "Согласование договора",
68
+ "id": "8195978",
69
+ "color": "#FFCCCC",
70
+ "editable": "Y",
71
+ "sort": "40"
72
+ },
73
+ {
74
+ "name": "Успешно реализовано",
75
+ "id": "142",
76
+ "color": "#CCFF66",
77
+ "editable": "N",
78
+ "sort": "600"
79
+ },
80
+ {
81
+ "name": "Закрыто и не реализовано",
82
+ "id": "143",
83
+ "color": "#D5D8DB",
84
+ "editable": "N",
85
+ "sort": "700"
86
+ }
87
+ ],
88
+ "custom_fields": {
89
+ "contacts": [
90
+ {
91
+ "id": "1460587",
92
+ "name": "Должность",
93
+ "code": "POSITION",
94
+ "multiple": "N",
95
+ "type_id": "1",
96
+ "disabled": "0"
97
+ },
98
+ {
99
+ "id": "1460589",
100
+ "name": "Телефон",
101
+ "code": "PHONE",
102
+ "multiple": "Y",
103
+ "type_id": "8",
104
+ "disabled": "0",
105
+ "enums": {
106
+ "3392086": "WORK",
107
+ "3392088": "WORKDD",
108
+ "3392090": "MOB",
109
+ "3392092": "FAX",
110
+ "3392094": "HOME",
111
+ "3392096": "OTHER"
112
+ }
113
+ },
114
+ {
115
+ "id": "1460591",
116
+ "name": "Email",
117
+ "code": "EMAIL",
118
+ "multiple": "Y",
119
+ "type_id": "8",
120
+ "disabled": "0",
121
+ "enums": {
122
+ "3392098": "WORK",
123
+ "3392100": "PRIV",
124
+ "3392102": "OTHER"
125
+ }
126
+ },
127
+ {
128
+ "id": "1460595",
129
+ "name": "Мгн. сообщения",
130
+ "code": "IM",
131
+ "multiple": "Y",
132
+ "type_id": "8",
133
+ "disabled": "0",
134
+ "enums": {
135
+ "3392104": "SKYPE",
136
+ "3392106": "ICQ",
137
+ "3392108": "JABBER",
138
+ "3392110": "GTALK",
139
+ "3392112": "MSN",
140
+ "3392114": "OTHER"
141
+ }
142
+ },
143
+ {
144
+ "id": "116302",
145
+ "name": "teachbase_id",
146
+ "multiple": "N",
147
+ "type_id": "8"
148
+ }
149
+ ],
150
+ "leads": [
151
+ {
152
+ "id": "484604",
153
+ "name": "textfield",
154
+ "code": null,
155
+ "multiple": "N",
156
+ "type_id": "1"
157
+ },
158
+ {
159
+ "id": "484606",
160
+ "name": "Flag",
161
+ "code": null,
162
+ "multiple": "N",
163
+ "type_id": "3"
164
+ }
165
+ ],
166
+ "companies": [
167
+ {
168
+ "id": "1460589",
169
+ "name": "Телефон",
170
+ "code": "PHONE",
171
+ "multiple": "Y",
172
+ "type_id": "8",
173
+ "disabled": "0",
174
+ "enums": {
175
+ "3392086": "WORK",
176
+ "3392088": "WORKDD",
177
+ "3392090": "MOB",
178
+ "3392092": "FAX",
179
+ "3392094": "HOME",
180
+ "3392096": "OTHER"
181
+ }
182
+ },
183
+ {
184
+ "id": "1460591",
185
+ "name": "Email",
186
+ "code": "EMAIL",
187
+ "multiple": "Y",
188
+ "type_id": "8",
189
+ "disabled": "0",
190
+ "enums": {
191
+ "3392098": "WORK",
192
+ "3392100": "PRIV",
193
+ "3392102": "OTHER"
194
+ }
195
+ },
196
+ {
197
+ "id": "1460593",
198
+ "name": "Web",
199
+ "code": "WEB",
200
+ "multiple": "N",
201
+ "type_id": "7",
202
+ "disabled": "0"
203
+ },
204
+ {
205
+ "id": "1460597",
206
+ "name": "Адрес",
207
+ "code": "ADDRESS",
208
+ "multiple": "N",
209
+ "type_id": "9",
210
+ "disabled": "0"
211
+ }
212
+ ]
213
+ },
214
+ "note_types": [
215
+ {
216
+ "id": 1,
217
+ "name": "",
218
+ "code": "DEAL_CREATED",
219
+ "editable": "N"
220
+ },
221
+ {
222
+ "id": 2,
223
+ "name": "",
224
+ "code": "CONTACT_CREATED",
225
+ "editable": "N"
226
+ },
227
+ {
228
+ "id": 3,
229
+ "name": "",
230
+ "code": "DEAL_STATUS_CHANGED",
231
+ "editable": "N"
232
+ },
233
+ {
234
+ "id": 4,
235
+ "name": "",
236
+ "code": "COMMON",
237
+ "editable": "Y"
238
+ },
239
+ {
240
+ "id": 5,
241
+ "name": "",
242
+ "code": "ATTACHEMENT",
243
+ "editable": "N"
244
+ },
245
+ {
246
+ "id": 6,
247
+ "name": "",
248
+ "code": "CALL",
249
+ "editable": "N"
250
+ },
251
+ {
252
+ "id": 7,
253
+ "name": "",
254
+ "code": "MAIL_MESSAGE",
255
+ "editable": "N"
256
+ },
257
+ {
258
+ "id": 8,
259
+ "name": "",
260
+ "code": "MAIL_MESSAGE_ATTACHMENT",
261
+ "editable": "N"
262
+ },
263
+ {
264
+ "id": 9,
265
+ "name": "",
266
+ "code": "EXTERNAL_ATTACH",
267
+ "editable": "N"
268
+ },
269
+ {
270
+ "id": 10,
271
+ "name": "",
272
+ "code": "CALL_IN",
273
+ "editable": "N"
274
+ },
275
+ {
276
+ "id": 11,
277
+ "name": "",
278
+ "code": "CALL_OUT",
279
+ "editable": "N"
280
+ },
281
+ {
282
+ "id": 12,
283
+ "name": "",
284
+ "code": "COMPANY_CREATED",
285
+ "editable": "N"
286
+ },
287
+ {
288
+ "id": 13,
289
+ "name": "",
290
+ "code": "TASK_RESULT",
291
+ "editable": "N"
292
+ },
293
+ {
294
+ "id": 99,
295
+ "name": "",
296
+ "code": "MAX_SYSTEM",
297
+ "editable": "N"
298
+ },
299
+ {
300
+ "id": 101,
301
+ "name": "Ссылка",
302
+ "code": "DROPBOX",
303
+ "editable": "N"
304
+ },
305
+ {
306
+ "id": 102,
307
+ "name": "Входящее",
308
+ "code": "SMS_IN",
309
+ "editable": "N"
310
+ },
311
+ {
312
+ "id": 103,
313
+ "name": "Исходящее",
314
+ "code": "SMS_OUT",
315
+ "editable": "N"
316
+ }
317
+ ],
318
+ "task_types": [
319
+ {
320
+ "id": 1,
321
+ "name": "Q_TASKS_CLASS_FOLLOW_UP",
322
+ "code": "FOLLOW_UP"
323
+ },
324
+ {
325
+ "id": 1,
326
+ "name": "Звонок",
327
+ "code": "CALL"
328
+ },
329
+ {
330
+ "id": 2,
331
+ "name": "Встреча",
332
+ "code": "MEETING"
333
+ },
334
+ {
335
+ "id": 3,
336
+ "name": "Письмо",
337
+ "code": "LETTER"
338
+ }
339
+ ],
340
+ "timezoneoffset": "+03:00"
341
+ },
342
+ "server_time": 1422442143
343
+ }
344
+ }