agilecrm-wrapper 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +3 -3
- data/LICENSE +0 -2
- data/lib/agilecrm-wrapper/contact.rb +11 -3
- data/lib/agilecrm-wrapper/version.rb +1 -1
- data/spec/agilecrm-wrapper/contact_spec.rb +7 -1
- data/spec/fixtures/contacts/get_contact.json +9 -1
- data/spec/support/fake_agilecrm.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8164dd410e9b3170832a19d196f36341392189
|
4
|
+
data.tar.gz: 796ffe45dc8617ac270eb481d3d967205415255f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ccfe9651395b4d22e178d7cdcecaba597380cf6004e65d3e735d8e69566d060e785e6b2be1258bdd356c2fad758b5b11e91c7a12851b1ce9035ee6938841a3
|
7
|
+
data.tar.gz: 790244c1538b85d322466d6d39b5060e86c9592550c4cec600e5bce9c7b56c0511e2641c06d989eb99db68c77843b69c8a91523ec8ec7b2a311240fce9157640
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
agilecrm-wrapper (1.0.
|
4
|
+
agilecrm-wrapper (1.0.2)
|
5
5
|
faraday (~> 0.9)
|
6
6
|
faraday_middleware
|
7
7
|
hashie
|
@@ -23,8 +23,8 @@ GEM
|
|
23
23
|
multipart-post (>= 1.2, < 3)
|
24
24
|
faraday_middleware (0.9.1)
|
25
25
|
faraday (>= 0.7.4, < 0.10)
|
26
|
-
hashie (3.3.
|
27
|
-
json (1.8.
|
26
|
+
hashie (3.3.2)
|
27
|
+
json (1.8.2)
|
28
28
|
method_source (0.8.2)
|
29
29
|
multipart-post (2.0.0)
|
30
30
|
parser (2.2.0.pre.5)
|
data/LICENSE
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014 Cogmation Robotics Inc.
|
4
|
-
|
5
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
4
|
of this software and associated documentation files (the "Software"), to deal
|
7
5
|
in the Software without restriction, including without limitation the rights
|
@@ -41,7 +41,11 @@ module AgileCRMWrapper
|
|
41
41
|
|
42
42
|
def create(options = {})
|
43
43
|
payload = parse_contact_fields(options)
|
44
|
-
AgileCRMWrapper.connection.post('contacts', payload)
|
44
|
+
response = AgileCRMWrapper.connection.post('contacts', payload)
|
45
|
+
if response && response.status == 200
|
46
|
+
contact = new(response.body)
|
47
|
+
end
|
48
|
+
contact
|
45
49
|
end
|
46
50
|
|
47
51
|
def delete(arg)
|
@@ -98,8 +102,12 @@ module AgileCRMWrapper
|
|
98
102
|
|
99
103
|
def get_property(property_name)
|
100
104
|
return unless respond_to?(:properties)
|
101
|
-
|
102
|
-
|
105
|
+
arr = properties.select { |a| a['name'] == property_name.to_s }
|
106
|
+
if arr.length > 1
|
107
|
+
arr.map {|i| i['value'] }
|
108
|
+
else
|
109
|
+
arr.first['value'] if arr.first
|
110
|
+
end
|
103
111
|
end
|
104
112
|
|
105
113
|
private
|
@@ -63,7 +63,7 @@ describe AgileCRMWrapper::Contact do
|
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|
66
|
-
its(:
|
66
|
+
its(:class) { should eq AgileCRMWrapper::Contact }
|
67
67
|
end
|
68
68
|
|
69
69
|
describe '#notes' do
|
@@ -97,6 +97,12 @@ describe AgileCRMWrapper::Contact do
|
|
97
97
|
expect(contact.get_property('nil-propety')).to be_nil
|
98
98
|
end
|
99
99
|
end
|
100
|
+
|
101
|
+
context 'two properties share the same name' do
|
102
|
+
it 'returns an array' do
|
103
|
+
expect(contact.get_property('phone_number').class).to eq(Array)
|
104
|
+
end
|
105
|
+
end
|
100
106
|
end
|
101
107
|
|
102
108
|
describe '#destroy' do
|
@@ -37,9 +37,17 @@
|
|
37
37
|
"type": "CUSTOM",
|
38
38
|
"name": "custom_field",
|
39
39
|
"value": "Im a custom field!"
|
40
|
+
}, {
|
41
|
+
"type": "CUSTOM",
|
42
|
+
"name": "phone_number",
|
43
|
+
"value": "1231111111"
|
44
|
+
}, {
|
45
|
+
"type": "CUSTOM",
|
46
|
+
"name": "phone_number",
|
47
|
+
"value": "1232222222"
|
40
48
|
}],
|
41
49
|
"campaignStatus": [],
|
42
50
|
"entity_type": "contact_entity",
|
43
51
|
"unsubscribeStatus": [],
|
44
52
|
"emailBounceStatus": []
|
45
|
-
}
|
53
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agilecrm-wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|