capsule_crm 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/CHANGELOG.md +6 -0
- data/README.md +3 -1
- data/lib/capsule_crm/organization.rb +1 -1
- data/lib/capsule_crm/serializer.rb +6 -6
- data/lib/capsule_crm/version.rb +1 -1
- data/spec/lib/capsule_crm/serializer_spec.rb +8 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c64b18ad5ae22dbcaf9ace0fdd893299911b925
|
4
|
+
data.tar.gz: f684b6a5d8f79d5fb6e5ed275daacd5243621240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19d1fbd6fa1f9a4f024a823cf5262ff7118cedefee045c376e2bfa9a7fffb5578b770e72a7a45cc0b90635244b394780aa59dd1057796f4290848f688459a269
|
7
|
+
data.tar.gz: cb636752bac73d982aab671b6737da532205510e46d902faef671250b761e9481447c8f61c384e5d2703f5aa1c856c2b1358c77648be113e2de71ee2702c019a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.5.2
|
4
|
+
|
5
|
+
- Fix issue with ruby 1.9.3 where incompatible OpenStruct syntax was being used.
|
6
|
+
Also, update tests to actually use OpenStructs not hashes. (@ryanbooker)
|
7
|
+
- Fix the update path for organizations. It was missing the org.id part. (@ghiculescu)
|
8
|
+
|
3
9
|
## 1.5.1
|
4
10
|
|
5
11
|
- Add ID to email, website, address and phone models to fix bug where they were
|
data/README.md
CHANGED
@@ -304,7 +304,7 @@ CapsuleCRM::Currency.all
|
|
304
304
|
|
305
305
|
## Supported Rubies
|
306
306
|
|
307
|
-
|
307
|
+
2.0.x, 2.1.x
|
308
308
|
|
309
309
|
## Versioning
|
310
310
|
|
@@ -333,3 +333,5 @@ Many thanks to the following contributers:
|
|
333
333
|
- @srbaker
|
334
334
|
- @clod81
|
335
335
|
- @danthompson
|
336
|
+
- @ryanbooker
|
337
|
+
- @ghiculescu
|
@@ -24,7 +24,7 @@ module CapsuleCRM
|
|
24
24
|
|
25
25
|
persistable_config do |config|
|
26
26
|
config.create = lambda { |org| "organisation" }
|
27
|
-
config.update = lambda { |org| "organisation" }
|
27
|
+
config.update = lambda { |org| "organisation/#{org.id}" }
|
28
28
|
config.destroy = lambda { |org| "party/#{org.id}" }
|
29
29
|
end
|
30
30
|
|
@@ -34,26 +34,26 @@ module CapsuleCRM
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def root
|
37
|
-
@root ||= options
|
37
|
+
@root ||= options.root ||
|
38
38
|
object.class.to_s.demodulize.downcase.singularize.camelize(:lower)
|
39
39
|
end
|
40
40
|
|
41
41
|
def collection_root
|
42
|
-
@collection_root ||= options
|
42
|
+
@collection_root ||= options.collection_root || root.pluralize
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
46
46
|
|
47
47
|
def include_root?
|
48
|
-
@include_root ||= true unless options
|
48
|
+
@include_root ||= true unless options.include_root == false
|
49
49
|
end
|
50
50
|
|
51
51
|
def additional_methods
|
52
|
-
@additional_methods ||= options
|
52
|
+
@additional_methods ||= options.additional_methods || []
|
53
53
|
end
|
54
54
|
|
55
55
|
def excluded_keys
|
56
|
-
@excluded_keys ||= options
|
56
|
+
@excluded_keys ||= options.excluded_keys || []
|
57
57
|
end
|
58
58
|
|
59
59
|
def build_attributes_hash
|
@@ -80,7 +80,7 @@ module CapsuleCRM
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def exclude_id?
|
83
|
-
@exclude_id ||= true unless options
|
83
|
+
@exclude_id ||= true unless options.exclude_id == false
|
84
84
|
end
|
85
85
|
|
86
86
|
# TODO OMG, clean this up!
|
data/lib/capsule_crm/version.rb
CHANGED
@@ -18,7 +18,7 @@ end
|
|
18
18
|
describe CapsuleCRM::Serializer do
|
19
19
|
describe '#serialize' do
|
20
20
|
let(:options) do
|
21
|
-
|
21
|
+
OpenStruct.new
|
22
22
|
end
|
23
23
|
let(:serializer) { described_class.new(options) }
|
24
24
|
let(:object) do
|
@@ -36,7 +36,9 @@ describe CapsuleCRM::Serializer do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when exclude_id is false' do
|
39
|
-
before
|
39
|
+
before do
|
40
|
+
options.exclude_id = false
|
41
|
+
end
|
40
42
|
|
41
43
|
it 'should include the ID' do
|
42
44
|
expect(subject['serializabletest'].keys).to include('id')
|
@@ -45,7 +47,7 @@ describe CapsuleCRM::Serializer do
|
|
45
47
|
|
46
48
|
context 'when include_root is false' do
|
47
49
|
before do
|
48
|
-
options.
|
50
|
+
options.include_root = false
|
49
51
|
end
|
50
52
|
|
51
53
|
it 'should not include the root' do
|
@@ -57,7 +59,7 @@ describe CapsuleCRM::Serializer do
|
|
57
59
|
|
58
60
|
context 'when additional methods are supplied' do
|
59
61
|
before do
|
60
|
-
options.
|
62
|
+
options.additional_methods = [:test]
|
61
63
|
object.stub(:test).and_return(test_object)
|
62
64
|
end
|
63
65
|
let(:test_object) { double(to_capsule_json: { foo: :bar }) }
|
@@ -69,7 +71,7 @@ describe CapsuleCRM::Serializer do
|
|
69
71
|
|
70
72
|
context 'when excluded keys are supplied' do
|
71
73
|
before do
|
72
|
-
options.
|
74
|
+
options.excluded_keys = [:description]
|
73
75
|
end
|
74
76
|
|
75
77
|
it 'should not include the excluded keys in the output' do
|
@@ -79,7 +81,7 @@ describe CapsuleCRM::Serializer do
|
|
79
81
|
|
80
82
|
context 'when are root element name is supplied' do
|
81
83
|
before do
|
82
|
-
options.
|
84
|
+
options.root = 'whatever'
|
83
85
|
end
|
84
86
|
|
85
87
|
it 'should use the root option as the root key' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capsule_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Beedle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -499,3 +499,4 @@ test_files:
|
|
499
499
|
- spec/support/shared_examples/persistable.rb
|
500
500
|
- spec/support/single_person.json
|
501
501
|
- spec/support/task.json
|
502
|
+
has_rdoc:
|