amorail 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.rubocop.yml +61 -0
- data/.travis.yml +9 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +245 -0
- data/Rakefile +15 -0
- data/amorail.gemspec +33 -0
- data/lib/amorail.rb +49 -0
- data/lib/amorail/client.rb +101 -0
- data/lib/amorail/config.rb +17 -0
- data/lib/amorail/entities/company.rb +23 -0
- data/lib/amorail/entities/contact.rb +29 -0
- data/lib/amorail/entities/contact_link.rb +32 -0
- data/lib/amorail/entities/elementable.rb +37 -0
- data/lib/amorail/entities/lead.rb +26 -0
- data/lib/amorail/entities/leadable.rb +29 -0
- data/lib/amorail/entities/note.rb +17 -0
- data/lib/amorail/entities/task.rb +18 -0
- data/lib/amorail/entities/webhook.rb +42 -0
- data/lib/amorail/entity.rb +128 -0
- data/lib/amorail/entity/finders.rb +67 -0
- data/lib/amorail/entity/params.rb +95 -0
- data/lib/amorail/entity/persistence.rb +66 -0
- data/lib/amorail/exceptions.rb +25 -0
- data/lib/amorail/property.rb +130 -0
- data/lib/amorail/railtie.rb +8 -0
- data/lib/amorail/version.rb +4 -0
- data/lib/tasks/amorail.rake +6 -0
- data/spec/client_spec.rb +123 -0
- data/spec/company_spec.rb +82 -0
- data/spec/contact_link_spec.rb +40 -0
- data/spec/contact_spec.rb +187 -0
- data/spec/entity_spec.rb +55 -0
- data/spec/fixtures/accounts/response_1.json +344 -0
- data/spec/fixtures/accounts/response_2.json +195 -0
- data/spec/fixtures/amorail_test.yml +3 -0
- data/spec/fixtures/contacts/create.json +13 -0
- data/spec/fixtures/contacts/find_many.json +57 -0
- data/spec/fixtures/contacts/find_one.json +41 -0
- data/spec/fixtures/contacts/links.json +16 -0
- data/spec/fixtures/contacts/my_contact_find.json +47 -0
- data/spec/fixtures/contacts/update.json +13 -0
- data/spec/fixtures/leads/create.json +13 -0
- data/spec/fixtures/leads/find_many.json +73 -0
- data/spec/fixtures/leads/links.json +16 -0
- data/spec/fixtures/leads/update.json +13 -0
- data/spec/fixtures/leads/update_errors.json +12 -0
- data/spec/fixtures/webhooks/list.json +24 -0
- data/spec/fixtures/webhooks/subscribe.json +17 -0
- data/spec/fixtures/webhooks/unsubscribe.json +17 -0
- data/spec/helpers/webmock_helpers.rb +279 -0
- data/spec/lead_spec.rb +101 -0
- data/spec/my_contact_spec.rb +48 -0
- data/spec/note_spec.rb +26 -0
- data/spec/property_spec.rb +45 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/elementable_example.rb +52 -0
- data/spec/support/entity_class_example.rb +15 -0
- data/spec/support/leadable_example.rb +33 -0
- data/spec/support/my_contact.rb +3 -0
- data/spec/support/my_entity.rb +4 -0
- data/spec/task_spec.rb +49 -0
- data/spec/webhook_spec.rb +59 -0
- metadata +319 -0
@@ -0,0 +1,195 @@
|
|
1
|
+
{
|
2
|
+
"response": {
|
3
|
+
"account": {
|
4
|
+
"id": "101",
|
5
|
+
"name": "База клиентов",
|
6
|
+
"subdomain": "custom_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": "Demo",
|
47
|
+
"id": "101",
|
48
|
+
"color": "#99CCFF",
|
49
|
+
"editable": "Y",
|
50
|
+
"sort": "10"
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"name": "Closed",
|
54
|
+
"id": "102",
|
55
|
+
"color": "#FFFF99",
|
56
|
+
"editable": "Y",
|
57
|
+
"sort": "20"
|
58
|
+
}
|
59
|
+
],
|
60
|
+
"custom_fields": {
|
61
|
+
"contacts": [
|
62
|
+
{
|
63
|
+
"id": "201",
|
64
|
+
"name": "Должность",
|
65
|
+
"code": "POSITION",
|
66
|
+
"multiple": "N",
|
67
|
+
"type_id": "1",
|
68
|
+
"disabled": "0"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"id": "202",
|
72
|
+
"name": "Телефон",
|
73
|
+
"code": "PHONE",
|
74
|
+
"multiple": "Y",
|
75
|
+
"type_id": "8",
|
76
|
+
"disabled": "0",
|
77
|
+
"enums": {
|
78
|
+
"3392086": "WORK",
|
79
|
+
"3392088": "WORKDD",
|
80
|
+
"3392090": "MOB",
|
81
|
+
"3392092": "FAX",
|
82
|
+
"3392094": "HOME",
|
83
|
+
"3392096": "OTHER"
|
84
|
+
}
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"id": "203",
|
88
|
+
"name": "Email",
|
89
|
+
"code": "EMAIL",
|
90
|
+
"multiple": "Y",
|
91
|
+
"type_id": "8",
|
92
|
+
"disabled": "0",
|
93
|
+
"enums": {
|
94
|
+
"3392098": "WORK",
|
95
|
+
"3392100": "PRIV",
|
96
|
+
"3392102": "OTHER"
|
97
|
+
}
|
98
|
+
},
|
99
|
+
{
|
100
|
+
"id": "204",
|
101
|
+
"name": "Мгн. сообщения",
|
102
|
+
"code": "IM",
|
103
|
+
"multiple": "Y",
|
104
|
+
"type_id": "8",
|
105
|
+
"disabled": "0",
|
106
|
+
"enums": {
|
107
|
+
"3392104": "SKYPE",
|
108
|
+
"3392106": "ICQ",
|
109
|
+
"3392108": "JABBER",
|
110
|
+
"3392110": "GTALK",
|
111
|
+
"3392112": "MSN",
|
112
|
+
"3392114": "OTHER"
|
113
|
+
}
|
114
|
+
}
|
115
|
+
],
|
116
|
+
"leads": [],
|
117
|
+
"companies": [
|
118
|
+
{
|
119
|
+
"id": "301",
|
120
|
+
"name": "Телефон",
|
121
|
+
"code": "PHONE",
|
122
|
+
"multiple": "Y",
|
123
|
+
"type_id": "8",
|
124
|
+
"disabled": "0",
|
125
|
+
"enums": {
|
126
|
+
"3392086": "WORK",
|
127
|
+
"3392088": "WORKDD",
|
128
|
+
"3392090": "MOB",
|
129
|
+
"3392092": "FAX",
|
130
|
+
"3392094": "HOME",
|
131
|
+
"3392096": "OTHER"
|
132
|
+
}
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"id": "302",
|
136
|
+
"name": "Email",
|
137
|
+
"code": "EMAIL",
|
138
|
+
"multiple": "Y",
|
139
|
+
"type_id": "8",
|
140
|
+
"disabled": "0",
|
141
|
+
"enums": {
|
142
|
+
"3392098": "WORK",
|
143
|
+
"3392100": "PRIV",
|
144
|
+
"3392102": "OTHER"
|
145
|
+
}
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"id": "303",
|
149
|
+
"name": "Web",
|
150
|
+
"code": "WEB",
|
151
|
+
"multiple": "N",
|
152
|
+
"type_id": "7",
|
153
|
+
"disabled": "0"
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"id": "304",
|
157
|
+
"name": "Адрес",
|
158
|
+
"code": "ADDRESS",
|
159
|
+
"multiple": "N",
|
160
|
+
"type_id": "9",
|
161
|
+
"disabled": "0"
|
162
|
+
}
|
163
|
+
]
|
164
|
+
},
|
165
|
+
"note_types": [
|
166
|
+
{
|
167
|
+
"id": 1000,
|
168
|
+
"name": "",
|
169
|
+
"code": "DEMO_REQUESTED",
|
170
|
+
"editable": "N"
|
171
|
+
},
|
172
|
+
{
|
173
|
+
"id": 1001,
|
174
|
+
"name": "",
|
175
|
+
"code": "BILL_CREATED",
|
176
|
+
"editable": "N"
|
177
|
+
}
|
178
|
+
],
|
179
|
+
"task_types": [
|
180
|
+
{
|
181
|
+
"id": 1,
|
182
|
+
"name": "Звонок",
|
183
|
+
"code": "CALL"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"id": 2,
|
187
|
+
"name": "Встреча",
|
188
|
+
"code": "MEETING"
|
189
|
+
}
|
190
|
+
],
|
191
|
+
"timezoneoffset": "+03:00"
|
192
|
+
},
|
193
|
+
"server_time": 1422442143
|
194
|
+
}
|
195
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"response": {
|
3
|
+
"contacts": [
|
4
|
+
{
|
5
|
+
"id": 101,
|
6
|
+
"name": "Foo bar",
|
7
|
+
"account_id": "8195968",
|
8
|
+
"last_modified": 1423139130,
|
9
|
+
"company_name": "Foo Inc.",
|
10
|
+
"custom_fields": [
|
11
|
+
{
|
12
|
+
"id": "1460591",
|
13
|
+
"name": "Email",
|
14
|
+
"code": "EMAIL",
|
15
|
+
"values": [
|
16
|
+
{
|
17
|
+
"value": "foo@tb.com",
|
18
|
+
"enum": "3392098"
|
19
|
+
}
|
20
|
+
]
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"id": "1460589",
|
24
|
+
"name": "Телефон",
|
25
|
+
"code": "PHONE",
|
26
|
+
"values": [
|
27
|
+
{
|
28
|
+
"value": "1111 111 111",
|
29
|
+
"enum": "3392086"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
33
|
+
]
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"id": 102,
|
37
|
+
"name": "Foo bar 2",
|
38
|
+
"account_id": "8195968",
|
39
|
+
"last_modified": 1423139150,
|
40
|
+
"company_name": "Foo Inc.",
|
41
|
+
"custom_fields": [
|
42
|
+
{
|
43
|
+
"id": "1460591",
|
44
|
+
"name": "Email",
|
45
|
+
"code": "EMAIL",
|
46
|
+
"values": [
|
47
|
+
{
|
48
|
+
"value": "foo2@tb.com",
|
49
|
+
"enum": "3392098"
|
50
|
+
}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"response": {
|
3
|
+
"contacts": [
|
4
|
+
{
|
5
|
+
"id": 101,
|
6
|
+
"name": "Foo bar",
|
7
|
+
"account_id": "8195968",
|
8
|
+
"last_modified": 1423139130,
|
9
|
+
"company_name": "Foo Inc.",
|
10
|
+
"linked_leads_id": [
|
11
|
+
"1872746",
|
12
|
+
"1885024"
|
13
|
+
],
|
14
|
+
"custom_fields": [
|
15
|
+
{
|
16
|
+
"id": "1460591",
|
17
|
+
"name": "Email",
|
18
|
+
"code": "EMAIL",
|
19
|
+
"values": [
|
20
|
+
{
|
21
|
+
"value": "foo@tb.com",
|
22
|
+
"enum": "3392098"
|
23
|
+
}
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"id": "1460589",
|
28
|
+
"name": "Телефон",
|
29
|
+
"code": "PHONE",
|
30
|
+
"values": [
|
31
|
+
{
|
32
|
+
"value": "1111 111 111",
|
33
|
+
"enum": "3392086"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
]
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"response": {
|
3
|
+
"contacts": [
|
4
|
+
{
|
5
|
+
"id": 11,
|
6
|
+
"name": "Foo bar",
|
7
|
+
"account_id": "8195968",
|
8
|
+
"last_modified": 1423139130,
|
9
|
+
"company_name": "Foo Inc.",
|
10
|
+
"custom_fields": [
|
11
|
+
{
|
12
|
+
"id": "1460591",
|
13
|
+
"name": "Email",
|
14
|
+
"code": "EMAIL",
|
15
|
+
"values": [
|
16
|
+
{
|
17
|
+
"value": "foo@tb.com",
|
18
|
+
"enum": "3392098"
|
19
|
+
}
|
20
|
+
]
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"id": "1460589",
|
24
|
+
"name": "Телефон",
|
25
|
+
"code": "PHONE",
|
26
|
+
"values": [
|
27
|
+
{
|
28
|
+
"value": "1111 111 111",
|
29
|
+
"enum": "3392086"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"id": "116302",
|
35
|
+
"name": "teachbase_id",
|
36
|
+
"values": [
|
37
|
+
{
|
38
|
+
"value": 1123,
|
39
|
+
"enum": "3392090"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
]
|
44
|
+
}
|
45
|
+
]
|
46
|
+
}
|
47
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
"response": {
|
3
|
+
"leads": [
|
4
|
+
{
|
5
|
+
"id": "1",
|
6
|
+
"name": "Research new technologies",
|
7
|
+
"last_modified": 1374656336,
|
8
|
+
"status_id": "7046196",
|
9
|
+
"pipeline_id": 683506,
|
10
|
+
"price": "500000",
|
11
|
+
"responsible_user_id": "103586",
|
12
|
+
"tags": [
|
13
|
+
{
|
14
|
+
"id": "960472",
|
15
|
+
"name": "USA"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"id": "960854",
|
19
|
+
"name": "Lead"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"date_create": 1386014400,
|
23
|
+
"account_id": "7046192",
|
24
|
+
"created_user_id": "4502311",
|
25
|
+
"custom_fields": [
|
26
|
+
{
|
27
|
+
"id": "484604",
|
28
|
+
"name": "field",
|
29
|
+
"values": [
|
30
|
+
{
|
31
|
+
"value": "text"
|
32
|
+
}
|
33
|
+
]
|
34
|
+
}
|
35
|
+
]
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"id": "2",
|
39
|
+
"name": "Sell it!",
|
40
|
+
"last_modified": 1374656336,
|
41
|
+
"status_id": "7046196",
|
42
|
+
"pipeline_id": 683506,
|
43
|
+
"price": "100000",
|
44
|
+
"responsible_user_id": "103586",
|
45
|
+
"tags": [
|
46
|
+
{
|
47
|
+
"id": "960472",
|
48
|
+
"name": "USA"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"id": "960854",
|
52
|
+
"name": "Lead"
|
53
|
+
}
|
54
|
+
],
|
55
|
+
"date_create": 1386014400,
|
56
|
+
"account_id": "7046192",
|
57
|
+
"created_user_id": "4502311",
|
58
|
+
"custom_fields": [
|
59
|
+
{
|
60
|
+
"id": "484604",
|
61
|
+
"name": "field",
|
62
|
+
"values": [
|
63
|
+
{
|
64
|
+
"value": "text"
|
65
|
+
}
|
66
|
+
]
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
],
|
71
|
+
"server_time": 1374839787
|
72
|
+
}
|
73
|
+
}
|