amorail 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/amorail/client.rb +5 -3
- data/lib/amorail/entities/lead.rb +1 -1
- data/lib/amorail/entity.rb +11 -10
- data/lib/amorail/entity/finders.rb +5 -3
- data/lib/amorail/entity/{persistance.rb → persistence.rb} +19 -0
- data/lib/amorail/version.rb +1 -1
- data/spec/fixtures/{account_response.json → accounts/response_1.json} +5 -5
- data/spec/fixtures/{account2_response.json → accounts/response_2.json} +1 -1
- data/spec/fixtures/{contact_create.json → contacts/create.json} +1 -1
- data/spec/fixtures/{contact_find_query.json → contacts/find_many.json} +3 -5
- data/spec/fixtures/{contact_find.json → contacts/find_one.json} +5 -6
- data/spec/fixtures/contacts/links.json +16 -0
- data/spec/fixtures/{my_contact_find.json → contacts/my_contact_find.json} +2 -3
- 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/helpers/webmock_helpers.rb +41 -14
- data/spec/lead_spec.rb +28 -0
- metadata +30 -24
- data/spec/fixtures/contact_update.json +0 -5
- data/spec/fixtures/contacts_links.json +0 -15
- data/spec/fixtures/leads.json +0 -69
- data/spec/fixtures/leads_links.json +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42a2851b1c9adb5f49a331d622c3fd276c63761b
|
4
|
+
data.tar.gz: 8012dce427d24125bfeb3a10059033c577bcbd5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a102ba6296a1e3ed6ab4f2c4160415429f351398e83240d0d2453a72c6302eefaf83c42624b43f037e00fb7dbc40f669f37ea27bd32d6311fe5d250a5b0dc248
|
7
|
+
data.tar.gz: b7214099abe616f5902717c4f823cabab5e818e84752cf649330cf70191c8b0b6488495f1b4e26fd7afcc27c5712d2431ef728356daefd5fd53a6d03b6b3af2b
|
data/lib/amorail/client.rb
CHANGED
@@ -6,6 +6,8 @@ require 'active_support'
|
|
6
6
|
module Amorail
|
7
7
|
# Amorail http client
|
8
8
|
class Client
|
9
|
+
SUCCESS_STATUS_CODES = [200, 204].freeze
|
10
|
+
|
9
11
|
attr_reader :usermail, :api_key, :api_endpoint
|
10
12
|
|
11
13
|
def initialize(api_endpoint: Amorail.config.api_endpoint,
|
@@ -41,10 +43,10 @@ module Amorail
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def safe_request(method, url, params = {})
|
44
|
-
|
46
|
+
public_send(method, url, params)
|
45
47
|
rescue ::Amorail::AmoUnauthorizedError
|
46
48
|
authorize
|
47
|
-
|
49
|
+
public_send(method, url, params)
|
48
50
|
end
|
49
51
|
|
50
52
|
def get(url, params = {})
|
@@ -72,7 +74,7 @@ module Amorail
|
|
72
74
|
end
|
73
75
|
|
74
76
|
def handle_response(response) # rubocop:disable all
|
75
|
-
return response if
|
77
|
+
return response if SUCCESS_STATUS_CODES.include?(response.status)
|
76
78
|
|
77
79
|
case response.status
|
78
80
|
when 301
|
data/lib/amorail/entity.rb
CHANGED
@@ -62,7 +62,7 @@ module Amorail
|
|
62
62
|
end
|
63
63
|
|
64
64
|
require 'amorail/entity/params'
|
65
|
-
require 'amorail/entity/
|
65
|
+
require 'amorail/entity/persistence'
|
66
66
|
require 'amorail/entity/finders'
|
67
67
|
|
68
68
|
def reload_model(info)
|
@@ -108,17 +108,18 @@ module Amorail
|
|
108
108
|
)
|
109
109
|
end
|
110
110
|
|
111
|
+
# We can have response with 200 or 204 here.
|
112
|
+
# 204 response has no body, so we don't want to parse it.
|
111
113
|
def handle_response(response, method)
|
112
|
-
return false
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
send(extract_method,
|
118
|
-
response.body['response'][self.class.amo_response_name]
|
119
|
-
)
|
114
|
+
return false if response.status == 204
|
115
|
+
|
116
|
+
data = send(
|
117
|
+
"extract_data_#{method}",
|
118
|
+
response.body['response'][self.class.amo_response_name]
|
120
119
|
)
|
121
|
-
|
120
|
+
reload_model(data)
|
121
|
+
rescue InvalidRecord
|
122
|
+
return false
|
122
123
|
end
|
123
124
|
end
|
124
125
|
end
|
@@ -38,11 +38,13 @@ module Amorail # :nodoc: all
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
+
# We can have response with 200 or 204 here.
|
42
|
+
# 204 response has no body, so we don't want to parse it.
|
41
43
|
def load_many(response)
|
42
|
-
return []
|
44
|
+
return [] if response.status == 204
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
response.body['response'].fetch(amo_response_name, [])
|
47
|
+
.map { |info| new.reload_model(info) }
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
@@ -40,5 +40,24 @@ module Amorail # :nodoc: all
|
|
40
40
|
def extract_data_add(response)
|
41
41
|
response.fetch('add').first
|
42
42
|
end
|
43
|
+
|
44
|
+
# Update response can have status 200 and contain errors.
|
45
|
+
# In case of errors "update" key in a response is a Hash with "errors" key.
|
46
|
+
# If there are no errors "update" key is an Array with entities attributes.
|
47
|
+
def extract_data_update(response)
|
48
|
+
case data = response.fetch('update')
|
49
|
+
when Array
|
50
|
+
data.first
|
51
|
+
when Hash
|
52
|
+
merge_errors(data)
|
53
|
+
raise(InvalidRecord)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def merge_errors(data)
|
58
|
+
data.fetch("errors").each do |_, message|
|
59
|
+
errors.add(:base, message)
|
60
|
+
end
|
61
|
+
end
|
43
62
|
end
|
44
63
|
end
|
data/lib/amorail/version.rb
CHANGED
@@ -141,9 +141,9 @@
|
|
141
141
|
}
|
142
142
|
},
|
143
143
|
{
|
144
|
-
"id":
|
145
|
-
"name":
|
146
|
-
"multiple":
|
144
|
+
"id": "116302",
|
145
|
+
"name": "teachbase_id",
|
146
|
+
"multiple": "N",
|
147
147
|
"type_id": "8"
|
148
148
|
}
|
149
149
|
],
|
@@ -162,7 +162,7 @@
|
|
162
162
|
"multiple": "N",
|
163
163
|
"type_id": "3"
|
164
164
|
}
|
165
|
-
|
165
|
+
],
|
166
166
|
"companies": [
|
167
167
|
{
|
168
168
|
"id": "1460589",
|
@@ -341,4 +341,4 @@
|
|
341
341
|
},
|
342
342
|
"server_time": 1422442143
|
343
343
|
}
|
344
|
-
}
|
344
|
+
}
|
@@ -7,8 +7,7 @@
|
|
7
7
|
"account_id": "8195968",
|
8
8
|
"last_modified": 1423139130,
|
9
9
|
"company_name": "Foo Inc.",
|
10
|
-
"custom_fields":
|
11
|
-
[
|
10
|
+
"custom_fields": [
|
12
11
|
{
|
13
12
|
"id": "1460591",
|
14
13
|
"name": "Email",
|
@@ -39,8 +38,7 @@
|
|
39
38
|
"account_id": "8195968",
|
40
39
|
"last_modified": 1423139150,
|
41
40
|
"company_name": "Foo Inc.",
|
42
|
-
"custom_fields":
|
43
|
-
[
|
41
|
+
"custom_fields": [
|
44
42
|
{
|
45
43
|
"id": "1460591",
|
46
44
|
"name": "Email",
|
@@ -56,4 +54,4 @@
|
|
56
54
|
}
|
57
55
|
]
|
58
56
|
}
|
59
|
-
}
|
57
|
+
}
|
@@ -7,12 +7,11 @@
|
|
7
7
|
"account_id": "8195968",
|
8
8
|
"last_modified": 1423139130,
|
9
9
|
"company_name": "Foo Inc.",
|
10
|
-
"linked_leads_id":
|
11
|
-
|
12
|
-
|
10
|
+
"linked_leads_id": [
|
11
|
+
"1872746",
|
12
|
+
"1885024"
|
13
13
|
],
|
14
|
-
"custom_fields":
|
15
|
-
[
|
14
|
+
"custom_fields": [
|
16
15
|
{
|
17
16
|
"id": "1460591",
|
18
17
|
"name": "Email",
|
@@ -39,4 +38,4 @@
|
|
39
38
|
}
|
40
39
|
]
|
41
40
|
}
|
42
|
-
}
|
41
|
+
}
|
@@ -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
|
+
}
|
@@ -9,7 +9,7 @@ module AmoWebMock
|
|
9
9
|
account_info_stub(Amorail.config.api_endpoint)
|
10
10
|
end
|
11
11
|
|
12
|
-
def mock_custom_api(endpoint, usermail, api_key, properties = '
|
12
|
+
def mock_custom_api(endpoint, usermail, api_key, properties = 'response_2.json')
|
13
13
|
authorize_stub(
|
14
14
|
endpoint,
|
15
15
|
usermail,
|
@@ -33,10 +33,10 @@ module AmoWebMock
|
|
33
33
|
})
|
34
34
|
end
|
35
35
|
|
36
|
-
def account_info_stub(endpoint, properties = '
|
36
|
+
def account_info_stub(endpoint, properties = 'response_1.json')
|
37
37
|
stub_request(:get, endpoint + '/private/api/v2/json/accounts/current')
|
38
38
|
.to_return(
|
39
|
-
body: File.read("./spec/fixtures/#{properties}"),
|
39
|
+
body: File.read("./spec/fixtures/accounts/#{properties}"),
|
40
40
|
headers: { 'Content-Type' => 'application/json' },
|
41
41
|
status: 200
|
42
42
|
)
|
@@ -61,7 +61,7 @@ module AmoWebMock
|
|
61
61
|
def contact_create_stub(endpoint)
|
62
62
|
stub_request(:post, endpoint + '/private/api/v2/json/contacts/set')
|
63
63
|
.to_return(
|
64
|
-
body: File.read('./spec/fixtures/
|
64
|
+
body: File.read('./spec/fixtures/contacts/create.json'),
|
65
65
|
headers: { 'Content-Type' => 'application/json' },
|
66
66
|
status: 200
|
67
67
|
)
|
@@ -70,7 +70,7 @@ module AmoWebMock
|
|
70
70
|
def contact_update_stub(endpoint)
|
71
71
|
stub_request(:post, endpoint + '/private/api/v2/json/contacts/set')
|
72
72
|
.to_return(
|
73
|
-
body: File.read('./spec/fixtures/
|
73
|
+
body: File.read('./spec/fixtures/contacts/update.json'),
|
74
74
|
headers: {
|
75
75
|
'Content-Type' => 'application/json'
|
76
76
|
},
|
@@ -84,7 +84,7 @@ module AmoWebMock
|
|
84
84
|
:get,
|
85
85
|
"#{endpoint}/private/api/v2/json/contacts/list?id=#{id}")
|
86
86
|
.to_return(
|
87
|
-
body: File.read('./spec/fixtures/
|
87
|
+
body: File.read('./spec/fixtures/contacts/find_one.json'),
|
88
88
|
headers: { 'Content-Type' => 'application/json' },
|
89
89
|
status: 200
|
90
90
|
)
|
@@ -102,7 +102,7 @@ module AmoWebMock
|
|
102
102
|
:get,
|
103
103
|
"#{endpoint}/private/api/v2/json/contacts/list?id=#{id}")
|
104
104
|
.to_return(
|
105
|
-
body: File.read('./spec/fixtures/my_contact_find.json'),
|
105
|
+
body: File.read('./spec/fixtures/contacts/my_contact_find.json'),
|
106
106
|
headers: { 'Content-Type' => 'application/json' },
|
107
107
|
status: 200
|
108
108
|
)
|
@@ -120,7 +120,7 @@ module AmoWebMock
|
|
120
120
|
:get,
|
121
121
|
"#{endpoint}/private/api/v2/json/contacts/list?query=#{query}")
|
122
122
|
.to_return(
|
123
|
-
body: File.read('./spec/fixtures/
|
123
|
+
body: File.read('./spec/fixtures/contacts/find_many.json'),
|
124
124
|
headers: { 'Content-Type' => 'application/json' },
|
125
125
|
status: 200
|
126
126
|
)
|
@@ -138,7 +138,7 @@ module AmoWebMock
|
|
138
138
|
:get,
|
139
139
|
"#{endpoint}/private/api/v2/json/contacts/list?#{ids.to_query('id')}")
|
140
140
|
.to_return(
|
141
|
-
body: File.read('./spec/fixtures/
|
141
|
+
body: File.read('./spec/fixtures/contacts/find_many.json'),
|
142
142
|
headers: { 'Content-Type' => 'application/json' },
|
143
143
|
status: 200
|
144
144
|
)
|
@@ -158,7 +158,7 @@ module AmoWebMock
|
|
158
158
|
).with(
|
159
159
|
query: params
|
160
160
|
).to_return(
|
161
|
-
body: File.read('./spec/fixtures/
|
161
|
+
body: File.read('./spec/fixtures/contacts/find_many.json'),
|
162
162
|
headers: { 'Content-Type' => 'application/json' },
|
163
163
|
status: 200
|
164
164
|
)
|
@@ -173,7 +173,7 @@ module AmoWebMock
|
|
173
173
|
def company_create_stub(endpoint)
|
174
174
|
stub_request(:post, endpoint + '/private/api/v2/json/company/set')
|
175
175
|
.to_return(
|
176
|
-
body: File.read('./spec/fixtures/
|
176
|
+
body: File.read('./spec/fixtures/contacts/create.json'),
|
177
177
|
headers: { 'Content-Type' => 'application/json' },
|
178
178
|
status: 200
|
179
179
|
)
|
@@ -185,7 +185,7 @@ module AmoWebMock
|
|
185
185
|
:get,
|
186
186
|
"#{endpoint}/private/api/v2/json/leads/list?#{ids.to_query('id')}")
|
187
187
|
.to_return(
|
188
|
-
body: File.read('./spec/fixtures/leads.json'),
|
188
|
+
body: File.read('./spec/fixtures/leads/find_many.json'),
|
189
189
|
headers: { 'Content-Type' => 'application/json' },
|
190
190
|
status: 200
|
191
191
|
)
|
@@ -197,10 +197,37 @@ module AmoWebMock
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
+
def lead_create_stub(endpoint)
|
201
|
+
stub_request(:post, endpoint + '/private/api/v2/json/leads/set')
|
202
|
+
.to_return(
|
203
|
+
body: File.read('./spec/fixtures/leads/create.json'),
|
204
|
+
headers: { 'Content-Type' => 'application/json' },
|
205
|
+
status: 200
|
206
|
+
)
|
207
|
+
end
|
208
|
+
|
209
|
+
def lead_update_stub(endpoint, success = true)
|
210
|
+
fixture_file =
|
211
|
+
if success
|
212
|
+
'./spec/fixtures/leads/update.json'
|
213
|
+
else
|
214
|
+
'./spec/fixtures/leads/update_errors.json'
|
215
|
+
end
|
216
|
+
|
217
|
+
stub_request(:post, endpoint + '/private/api/v2/json/leads/set')
|
218
|
+
.to_return(
|
219
|
+
body: File.read(fixture_file),
|
220
|
+
headers: {
|
221
|
+
'Content-Type' => 'application/json'
|
222
|
+
},
|
223
|
+
status: 200
|
224
|
+
)
|
225
|
+
end
|
226
|
+
|
200
227
|
def contacts_links_stub(endpoint, ids)
|
201
228
|
stub_request(:get, endpoint + "/private/api/v2/json/contacts/links?#{ids.to_query('contacts_link')}")
|
202
229
|
.to_return(
|
203
|
-
body: File.read('./spec/fixtures/
|
230
|
+
body: File.read('./spec/fixtures/contacts/links.json'),
|
204
231
|
headers: { 'Content-Type' => 'application/json' },
|
205
232
|
status: 200
|
206
233
|
)
|
@@ -210,7 +237,7 @@ module AmoWebMock
|
|
210
237
|
if success
|
211
238
|
stub_request(:get, endpoint + "/private/api/v2/json/contacts/links?#{ids.to_query('deals_link')}")
|
212
239
|
.to_return(
|
213
|
-
body: File.read('./spec/fixtures/
|
240
|
+
body: File.read('./spec/fixtures/leads/links.json'),
|
214
241
|
headers: { 'Content-Type' => 'application/json' },
|
215
242
|
status: 200
|
216
243
|
)
|
data/spec/lead_spec.rb
CHANGED
@@ -18,6 +18,7 @@ describe Amorail::Lead do
|
|
18
18
|
:name,
|
19
19
|
:price,
|
20
20
|
:status_id,
|
21
|
+
:pipeline_id,
|
21
22
|
:tags
|
22
23
|
)
|
23
24
|
end
|
@@ -29,6 +30,7 @@ describe Amorail::Lead do
|
|
29
30
|
name: 'Test',
|
30
31
|
price: 100,
|
31
32
|
status_id: 2,
|
33
|
+
pipeline_id: 17,
|
32
34
|
tags: 'test lead'
|
33
35
|
)
|
34
36
|
end
|
@@ -39,6 +41,7 @@ describe Amorail::Lead do
|
|
39
41
|
specify { is_expected.to include(name: 'Test') }
|
40
42
|
specify { is_expected.to include(price: 100) }
|
41
43
|
specify { is_expected.to include(status_id: 2) }
|
44
|
+
specify { is_expected.to include(pipeline_id: 17) }
|
42
45
|
specify { is_expected.to include(tags: 'test lead') }
|
43
46
|
end
|
44
47
|
|
@@ -70,4 +73,29 @@ describe Amorail::Lead do
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
end
|
76
|
+
|
77
|
+
describe "#update" do
|
78
|
+
subject { lead.update }
|
79
|
+
|
80
|
+
let(:lead) { described_class.new(name: 'RSpec lead', status_id: 142) }
|
81
|
+
|
82
|
+
before do
|
83
|
+
lead_create_stub(Amorail.config.api_endpoint)
|
84
|
+
lead.save!
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'with errors in response' do
|
88
|
+
before do
|
89
|
+
lead_update_stub(Amorail.config.api_endpoint, false)
|
90
|
+
lead.name = 'Updated name'
|
91
|
+
end
|
92
|
+
|
93
|
+
it { is_expected.to be_falsey }
|
94
|
+
|
95
|
+
specify do
|
96
|
+
subject
|
97
|
+
expect(lead.errors[:base]).to include('Last modified date is older than in database')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
73
101
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amorail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alekseenkoss
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -215,7 +215,7 @@ files:
|
|
215
215
|
- lib/amorail/entity.rb
|
216
216
|
- lib/amorail/entity/finders.rb
|
217
217
|
- lib/amorail/entity/params.rb
|
218
|
-
- lib/amorail/entity/
|
218
|
+
- lib/amorail/entity/persistence.rb
|
219
219
|
- lib/amorail/exceptions.rb
|
220
220
|
- lib/amorail/property.rb
|
221
221
|
- lib/amorail/railtie.rb
|
@@ -226,17 +226,20 @@ files:
|
|
226
226
|
- spec/contact_link_spec.rb
|
227
227
|
- spec/contact_spec.rb
|
228
228
|
- spec/entity_spec.rb
|
229
|
-
- spec/fixtures/
|
230
|
-
- spec/fixtures/
|
229
|
+
- spec/fixtures/accounts/response_1.json
|
230
|
+
- spec/fixtures/accounts/response_2.json
|
231
231
|
- spec/fixtures/amorail_test.yml
|
232
|
-
- spec/fixtures/
|
233
|
-
- spec/fixtures/
|
234
|
-
- spec/fixtures/
|
235
|
-
- spec/fixtures/
|
236
|
-
- spec/fixtures/
|
237
|
-
- spec/fixtures/
|
238
|
-
- spec/fixtures/
|
239
|
-
- spec/fixtures/
|
232
|
+
- spec/fixtures/contacts/create.json
|
233
|
+
- spec/fixtures/contacts/find_many.json
|
234
|
+
- spec/fixtures/contacts/find_one.json
|
235
|
+
- spec/fixtures/contacts/links.json
|
236
|
+
- spec/fixtures/contacts/my_contact_find.json
|
237
|
+
- spec/fixtures/contacts/update.json
|
238
|
+
- spec/fixtures/leads/create.json
|
239
|
+
- spec/fixtures/leads/find_many.json
|
240
|
+
- spec/fixtures/leads/links.json
|
241
|
+
- spec/fixtures/leads/update.json
|
242
|
+
- spec/fixtures/leads/update_errors.json
|
240
243
|
- spec/helpers/webmock_helpers.rb
|
241
244
|
- spec/lead_spec.rb
|
242
245
|
- spec/my_contact_spec.rb
|
@@ -269,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
269
272
|
version: '0'
|
270
273
|
requirements: []
|
271
274
|
rubyforge_project:
|
272
|
-
rubygems_version: 2.6.
|
275
|
+
rubygems_version: 2.6.12
|
273
276
|
signing_key:
|
274
277
|
specification_version: 4
|
275
278
|
summary: Ruby API client for AmoCRM
|
@@ -279,17 +282,20 @@ test_files:
|
|
279
282
|
- spec/contact_link_spec.rb
|
280
283
|
- spec/contact_spec.rb
|
281
284
|
- spec/entity_spec.rb
|
282
|
-
- spec/fixtures/
|
283
|
-
- spec/fixtures/
|
285
|
+
- spec/fixtures/accounts/response_1.json
|
286
|
+
- spec/fixtures/accounts/response_2.json
|
284
287
|
- spec/fixtures/amorail_test.yml
|
285
|
-
- spec/fixtures/
|
286
|
-
- spec/fixtures/
|
287
|
-
- spec/fixtures/
|
288
|
-
- spec/fixtures/
|
289
|
-
- spec/fixtures/
|
290
|
-
- spec/fixtures/
|
291
|
-
- spec/fixtures/
|
292
|
-
- spec/fixtures/
|
288
|
+
- spec/fixtures/contacts/create.json
|
289
|
+
- spec/fixtures/contacts/find_many.json
|
290
|
+
- spec/fixtures/contacts/find_one.json
|
291
|
+
- spec/fixtures/contacts/links.json
|
292
|
+
- spec/fixtures/contacts/my_contact_find.json
|
293
|
+
- spec/fixtures/contacts/update.json
|
294
|
+
- spec/fixtures/leads/create.json
|
295
|
+
- spec/fixtures/leads/find_many.json
|
296
|
+
- spec/fixtures/leads/links.json
|
297
|
+
- spec/fixtures/leads/update.json
|
298
|
+
- spec/fixtures/leads/update_errors.json
|
293
299
|
- spec/helpers/webmock_helpers.rb
|
294
300
|
- spec/lead_spec.rb
|
295
301
|
- spec/my_contact_spec.rb
|
data/spec/fixtures/leads.json
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"response": {
|
3
|
-
"leads": [
|
4
|
-
{
|
5
|
-
"id": "1",
|
6
|
-
"name": "Research new technologies",
|
7
|
-
"last_modified": 1374656336,
|
8
|
-
"status_id": "7046196",
|
9
|
-
"price": "500000",
|
10
|
-
"responsible_user_id": "103586",
|
11
|
-
"tags":[
|
12
|
-
{
|
13
|
-
"id": "960472",
|
14
|
-
"name": "USA"},
|
15
|
-
{
|
16
|
-
"id": "960854",
|
17
|
-
"name": "Lead"
|
18
|
-
}
|
19
|
-
],
|
20
|
-
"date_create": 1386014400,
|
21
|
-
"account_id": "7046192",
|
22
|
-
"created_user_id": "4502311",
|
23
|
-
"custom_fields": [
|
24
|
-
{
|
25
|
-
"id": "484604",
|
26
|
-
"name": "field",
|
27
|
-
"values": [
|
28
|
-
{
|
29
|
-
"value": "text"
|
30
|
-
}
|
31
|
-
]
|
32
|
-
}
|
33
|
-
]
|
34
|
-
},
|
35
|
-
{
|
36
|
-
"id": "2",
|
37
|
-
"name": "Sell it!",
|
38
|
-
"last_modified": 1374656336,
|
39
|
-
"status_id": "7046196",
|
40
|
-
"price": "100000",
|
41
|
-
"responsible_user_id": "103586",
|
42
|
-
"tags":[
|
43
|
-
{
|
44
|
-
"id": "960472",
|
45
|
-
"name": "USA"},
|
46
|
-
{
|
47
|
-
"id": "960854",
|
48
|
-
"name": "Lead"
|
49
|
-
}
|
50
|
-
],
|
51
|
-
"date_create": 1386014400,
|
52
|
-
"account_id": "7046192",
|
53
|
-
"created_user_id": "4502311",
|
54
|
-
"custom_fields": [
|
55
|
-
{
|
56
|
-
"id": "484604",
|
57
|
-
"name": "field",
|
58
|
-
"values": [
|
59
|
-
{
|
60
|
-
"value": "text"
|
61
|
-
}
|
62
|
-
]
|
63
|
-
}
|
64
|
-
]
|
65
|
-
}
|
66
|
-
],
|
67
|
-
"server_time": 1374839787
|
68
|
-
}
|
69
|
-
}
|