capsule_crm 0.7.0 → 0.7.1
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/Guardfile +1 -1
- data/README.md +0 -4
- data/lib/capsule_crm/contactable.rb +4 -0
- data/lib/capsule_crm/contacts.rb +3 -3
- data/lib/capsule_crm/organization.rb +1 -0
- data/lib/capsule_crm/version.rb +1 -1
- data/spec/lib/capsule_crm/organization_spec.rb +52 -0
- data/spec/lib/capsule_crm/person_spec.rb +3 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/support/shared_examples/contactable.rb +21 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86fd2febb988f9947d64a54b0c4c2761deb154a2
|
4
|
+
data.tar.gz: 3fe7d754695c00bd95d8ea2269df49559d1dc31d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1949c44a677c59a1e9d8a06ded0fce90e23c1ac76dc15479198965c528e75edf10ce88cafc23e7f251e88c48c90d323277937646b9d2eac2812e36c11ded33e0
|
7
|
+
data.tar.gz: eb8654fa8b5d168b6024d0f069de9587bdd2d770fe72154a0e562f52204b03e70942abad5d7418effc0acab5166af45366c0209505d80d33ae4b846259ed1bf9
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
[](https://travis-ci.org/mattbeedle/capsule_crm)
|
3
|
-
|
4
3
|
[](https://codeclimate.com/github/mattbeedle/capsule_crm)
|
6
|
-
|
7
5
|
[](http://badge.fury.io/rb/capsule_crm)
|
9
|
-
|
10
7
|
[](https://coveralls.io/r/mattbeedle/capsule_crm)
|
12
|
-
|
13
9
|
[](https://gemnasium.com/mattbeedle/capsule_crm)
|
15
11
|
|
@@ -3,9 +3,13 @@ module CapsuleCRM
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
+
delegate :phones, to: :contacts, allow_nil: true
|
6
7
|
delegate :phones=, to: :contacts
|
8
|
+
delegate :websites, to: :contacts, allow_nil: true
|
7
9
|
delegate :websites=, to: :contacts
|
10
|
+
delegate :emails, to: :contacts, allow_nil: true
|
8
11
|
delegate :emails=, to: :contacts
|
12
|
+
delegate :addresses, to: :contacts, allow_nil: true
|
9
13
|
delegate :addresses=, to: :contacts
|
10
14
|
end
|
11
15
|
|
data/lib/capsule_crm/contacts.rb
CHANGED
@@ -72,7 +72,7 @@ module CapsuleCRM
|
|
72
72
|
#
|
73
73
|
# Returns an Array of CapsuleCRM::Email objects
|
74
74
|
def emails
|
75
|
-
@emails
|
75
|
+
Array(@emails)
|
76
76
|
end
|
77
77
|
|
78
78
|
# Public: Sets the phones for this contacts controller
|
@@ -98,7 +98,7 @@ module CapsuleCRM
|
|
98
98
|
#
|
99
99
|
# Returns a Hash
|
100
100
|
def phones
|
101
|
-
@phones
|
101
|
+
Array(@phones)
|
102
102
|
end
|
103
103
|
|
104
104
|
# Public: Sets the websites for this contacts container
|
@@ -126,7 +126,7 @@ module CapsuleCRM
|
|
126
126
|
#
|
127
127
|
# Returns a Hash
|
128
128
|
def websites
|
129
|
-
@websites
|
129
|
+
Array(@websites)
|
130
130
|
end
|
131
131
|
|
132
132
|
# Public: Builds a hash of all contact information
|
data/lib/capsule_crm/version.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CapsuleCRM::Organization do
|
4
5
|
before { configure }
|
5
6
|
|
7
|
+
it_should_behave_like 'contactable'
|
8
|
+
|
6
9
|
before do
|
7
10
|
stub_request(:get, /\/api\/users$/).
|
8
11
|
to_return(body: File.read('spec/support/all_users.json'))
|
@@ -39,4 +42,53 @@ describe CapsuleCRM::Organization do
|
|
39
42
|
|
40
43
|
it { should be_a(Array) }
|
41
44
|
end
|
45
|
+
|
46
|
+
|
47
|
+
describe '#to_capsule_json' do
|
48
|
+
let(:address) do
|
49
|
+
CapsuleCRM::Address.new(
|
50
|
+
street: 'Oranienburgerstraße', city: 'Berlin', state: 'Berlin',
|
51
|
+
zip: '10117', country: 'de'
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:email) do
|
56
|
+
CapsuleCRM::Email.new(type: 'Work', email_address: 'mattscompany@gmail.com')
|
57
|
+
end
|
58
|
+
|
59
|
+
let(:contacts) do
|
60
|
+
CapsuleCRM::Contacts.new(addresses: [address], emails: [email])
|
61
|
+
end
|
62
|
+
|
63
|
+
let(:organization) do
|
64
|
+
CapsuleCRM::Organization.new(
|
65
|
+
name: "Matt's Company",
|
66
|
+
contacts: contacts
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
let(:email_json) { subject['contacts']['email'].first }
|
71
|
+
|
72
|
+
let(:address_json) { subject['contacts']['address'].first }
|
73
|
+
|
74
|
+
subject { organization.to_capsule_json['organisation'] }
|
75
|
+
|
76
|
+
it { should have_key('name') }
|
77
|
+
|
78
|
+
it { should have_key('contacts') }
|
79
|
+
|
80
|
+
it { address_json.should have_key('street') }
|
81
|
+
|
82
|
+
it { address_json.should have_key('city') }
|
83
|
+
|
84
|
+
it { address_json.should have_key('state') }
|
85
|
+
|
86
|
+
it { address_json.should have_key('zip') }
|
87
|
+
|
88
|
+
it { address_json.should have_key('country') }
|
89
|
+
|
90
|
+
it { email_json.should have_key('type') }
|
91
|
+
|
92
|
+
it { email_json.should have_key('emailAddress') }
|
93
|
+
end
|
42
94
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples 'contactable' do
|
2
|
+
it { expect(described_class.new).to respond_to(:contacts) }
|
3
|
+
|
4
|
+
it { expect(described_class.new).to respond_to(:contacts=) }
|
5
|
+
|
6
|
+
it { expect(described_class.new).to respond_to(:phones) }
|
7
|
+
|
8
|
+
it { expect(described_class.new).to respond_to(:phones=) }
|
9
|
+
|
10
|
+
it { expect(described_class.new).to respond_to(:websites) }
|
11
|
+
|
12
|
+
it { expect(described_class.new).to respond_to(:websites=) }
|
13
|
+
|
14
|
+
it { expect(described_class.new).to respond_to(:emails) }
|
15
|
+
|
16
|
+
it { expect(described_class.new).to respond_to(:emails=) }
|
17
|
+
|
18
|
+
it { expect(described_class.new).to respond_to(:addresses) }
|
19
|
+
|
20
|
+
it { expect(described_class.new).to respond_to(:addresses=) }
|
21
|
+
end
|
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: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Beedle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -315,6 +315,7 @@ files:
|
|
315
315
|
- spec/support/opportunity.json
|
316
316
|
- spec/support/organisation.json
|
317
317
|
- spec/support/person.json
|
318
|
+
- spec/support/shared_examples/contactable.rb
|
318
319
|
- spec/support/task.json
|
319
320
|
- spec/support/task_categories.json
|
320
321
|
homepage: ''
|
@@ -386,5 +387,6 @@ test_files:
|
|
386
387
|
- spec/support/opportunity.json
|
387
388
|
- spec/support/organisation.json
|
388
389
|
- spec/support/person.json
|
390
|
+
- spec/support/shared_examples/contactable.rb
|
389
391
|
- spec/support/task.json
|
390
392
|
- spec/support/task_categories.json
|