amorail 0.1.4 → 0.1.5
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/.gitignore +0 -1
- data/.hound.yml +10 -0
- data/.rubocop.yml +14 -0
- data/lib/amorail/client.rb +33 -28
- data/lib/amorail/config.rb +7 -1
- data/lib/amorail/engine.rb +2 -1
- data/lib/amorail/entities/company.rb +3 -0
- data/lib/amorail/entities/contact.rb +5 -2
- data/lib/amorail/entities/lead.rb +1 -0
- data/lib/amorail/entities/leadable.rb +6 -0
- data/lib/amorail/entities/task.rb +1 -15
- data/lib/amorail/entity/finders.rb +30 -0
- data/lib/amorail/entity/params.rb +95 -0
- data/lib/amorail/entity/persistance.rb +47 -0
- data/lib/amorail/entity.rb +23 -172
- data/lib/amorail/exceptions.rb +3 -4
- data/lib/amorail/{custom_fields.rb → property.rb} +24 -21
- data/lib/amorail/version.rb +2 -1
- data/lib/amorail.rb +3 -3
- data/lib/tasks/amorail.rake +3 -3
- data/spec/client_spec.rb +1 -1
- data/spec/company_spec.rb +22 -5
- data/spec/contact_spec.rb +28 -10
- data/spec/entity_spec.rb +11 -7
- data/spec/helpers/webmock_helpers.rb +85 -53
- data/spec/lead_spec.rb +19 -3
- data/spec/{custom_class_spec.rb → property_spec.rb} +5 -5
- data/spec/spec_helper.rb +4 -2
- data/spec/support/entity_class_example.rb +15 -0
- data/spec/task_spec.rb +25 -6
- metadata +11 -5
data/spec/task_spec.rb
CHANGED
@@ -12,12 +12,28 @@ describe Amorail::AmoTask do
|
|
12
12
|
it { should validate_presence_of(:complete_till) }
|
13
13
|
end
|
14
14
|
|
15
|
+
describe ".attributes" do
|
16
|
+
subject { described_class.attributes }
|
17
|
+
|
18
|
+
it_behaves_like 'entity_class'
|
19
|
+
|
20
|
+
specify do
|
21
|
+
is_expected.to include(
|
22
|
+
:element_type,
|
23
|
+
:element_id,
|
24
|
+
:text,
|
25
|
+
:task_type,
|
26
|
+
:complete_till
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
15
31
|
describe "contact and lead" do
|
16
|
-
let(:task) {
|
32
|
+
let(:task) { described_class.new }
|
17
33
|
it "set element_type on initialize" do
|
18
|
-
expect(
|
19
|
-
expect(
|
20
|
-
expect(
|
34
|
+
expect(described_class.new(lead: true).element_type).to eq 2
|
35
|
+
expect(described_class.new(contact: true).contact?).to be_truthy
|
36
|
+
expect(described_class.new(lead: false).element_type).to be_nil
|
21
37
|
end
|
22
38
|
|
23
39
|
it "set element_type with bang method" do
|
@@ -30,7 +46,7 @@ describe Amorail::AmoTask do
|
|
30
46
|
|
31
47
|
describe "#params" do
|
32
48
|
let(:task) do
|
33
|
-
|
49
|
+
described_class.new(
|
34
50
|
element_id: 1,
|
35
51
|
element_type: 1,
|
36
52
|
text: 'Win the war',
|
@@ -41,12 +57,15 @@ describe Amorail::AmoTask do
|
|
41
57
|
|
42
58
|
subject { task.params }
|
43
59
|
|
60
|
+
specify { is_expected.to include(:last_modified) }
|
44
61
|
specify { is_expected.to include(element_id: 1) }
|
45
62
|
specify { is_expected.to include(element_type: 1) }
|
46
63
|
specify { is_expected.to include(text: 'Win the war') }
|
47
64
|
specify { is_expected.to include(task_type: 'test') }
|
48
65
|
specify {
|
49
|
-
is_expected.to include(
|
66
|
+
is_expected.to include(
|
67
|
+
complete_till: Time.local(2015, 5, 9, 12, 0, 0).to_i
|
68
|
+
)
|
50
69
|
}
|
51
70
|
end
|
52
71
|
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.1.
|
4
|
+
version: 0.1.5
|
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: 2015-04-
|
12
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -191,20 +191,23 @@ files:
|
|
191
191
|
- lib/amorail.rb
|
192
192
|
- lib/amorail/client.rb
|
193
193
|
- lib/amorail/config.rb
|
194
|
-
- lib/amorail/custom_fields.rb
|
195
194
|
- lib/amorail/engine.rb
|
196
195
|
- lib/amorail/entities/company.rb
|
197
196
|
- lib/amorail/entities/contact.rb
|
198
197
|
- lib/amorail/entities/lead.rb
|
198
|
+
- lib/amorail/entities/leadable.rb
|
199
199
|
- lib/amorail/entities/task.rb
|
200
200
|
- lib/amorail/entity.rb
|
201
|
+
- lib/amorail/entity/finders.rb
|
202
|
+
- lib/amorail/entity/params.rb
|
203
|
+
- lib/amorail/entity/persistance.rb
|
201
204
|
- lib/amorail/exceptions.rb
|
205
|
+
- lib/amorail/property.rb
|
202
206
|
- lib/amorail/version.rb
|
203
207
|
- lib/tasks/amorail.rake
|
204
208
|
- spec/client_spec.rb
|
205
209
|
- spec/company_spec.rb
|
206
210
|
- spec/contact_spec.rb
|
207
|
-
- spec/custom_class_spec.rb
|
208
211
|
- spec/entity_spec.rb
|
209
212
|
- spec/fixtures/account_response.json
|
210
213
|
- spec/fixtures/amorail_test.yml
|
@@ -213,7 +216,9 @@ files:
|
|
213
216
|
- spec/fixtures/contact_update.json
|
214
217
|
- spec/helpers/webmock_helpers.rb
|
215
218
|
- spec/lead_spec.rb
|
219
|
+
- spec/property_spec.rb
|
216
220
|
- spec/spec_helper.rb
|
221
|
+
- spec/support/entity_class_example.rb
|
217
222
|
- spec/task_spec.rb
|
218
223
|
homepage: ''
|
219
224
|
licenses:
|
@@ -243,7 +248,6 @@ test_files:
|
|
243
248
|
- spec/client_spec.rb
|
244
249
|
- spec/company_spec.rb
|
245
250
|
- spec/contact_spec.rb
|
246
|
-
- spec/custom_class_spec.rb
|
247
251
|
- spec/entity_spec.rb
|
248
252
|
- spec/fixtures/account_response.json
|
249
253
|
- spec/fixtures/amorail_test.yml
|
@@ -252,6 +256,8 @@ test_files:
|
|
252
256
|
- spec/fixtures/contact_update.json
|
253
257
|
- spec/helpers/webmock_helpers.rb
|
254
258
|
- spec/lead_spec.rb
|
259
|
+
- spec/property_spec.rb
|
255
260
|
- spec/spec_helper.rb
|
261
|
+
- spec/support/entity_class_example.rb
|
256
262
|
- spec/task_spec.rb
|
257
263
|
has_rdoc:
|