agilecrm-wrapper 1.1.2 → 1.2.2
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 +1 -0
- data/README.md +9 -4
- data/lib/agilecrm-wrapper/contact.rb +9 -0
- data/lib/agilecrm-wrapper/version.rb +1 -1
- data/spec/agilecrm-wrapper/contact_spec.rb +8 -0
- data/spec/support/fake_agilecrm.rb +4 -0
- metadata +2 -3
- data/Gemfile.lock +0 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d15b190a01703b24915e62505a8a6b8b78b7612
|
4
|
+
data.tar.gz: c5ed615856075d490c1f268256a3698fecc40ce9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a31a718cf288d1357b8871129d4975200596cfa8633236e5615c6f4c6fd231af2b184688a6a539309c945aeebcd215b8b320c70c4a79d43a5c735dae64ef0008
|
7
|
+
data.tar.gz: 5eb132546b3cbd9f39ab1b9d44c8a3704ee24c212921711f5f43f024609e5eaf9469bc137de600138852e1ad4de4061d6b6e891d4dda70aa4d0efafb9ef675bb
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -74,6 +74,11 @@ contact.update(first_name: "Foo", last_name: "Bar", tags: ["new_tag"])
|
|
74
74
|
|
75
75
|
Note, tags specified in `update` will simply be added to the existing list of tags.
|
76
76
|
|
77
|
+
###### To remove tags from a contact
|
78
|
+
```ruby
|
79
|
+
contact.delete_tags(['foo', 'bar'])
|
80
|
+
```
|
81
|
+
|
77
82
|
###### To delete a single contact
|
78
83
|
```ruby
|
79
84
|
# perform operation directly
|
@@ -84,9 +89,9 @@ AgileCRMWrapper::Contact.find(123).destroy
|
|
84
89
|
|
85
90
|
###### Convenient access to properties hash values
|
86
91
|
```ruby
|
87
|
-
contact.get_property("email")
|
88
|
-
contact.
|
89
|
-
contact.get_property("unkown_attribute")
|
92
|
+
contact.get_property("email") #=> "blah@mail.com"
|
93
|
+
contact.get_property("my_custom_field") #=> "im a custom field!"
|
94
|
+
contact.get_property("unkown_attribute") #=> nil
|
90
95
|
```
|
91
96
|
|
92
97
|
### 2. Working with Notes
|
@@ -111,7 +116,7 @@ AgileCRMWrapper::Note.add_by_email(
|
|
111
116
|
|
112
117
|
### 3. Working with Tags
|
113
118
|
|
114
|
-
|
119
|
+
###### List all tags
|
115
120
|
```ruby
|
116
121
|
AgileCRMWrapper::Tag.all #=> [...]
|
117
122
|
```
|
@@ -87,6 +87,15 @@ module AgileCRMWrapper
|
|
87
87
|
self.class.delete(id)
|
88
88
|
end
|
89
89
|
|
90
|
+
def delete_tags(tags)
|
91
|
+
email = get_property('email')
|
92
|
+
response = AgileCRMWrapper.connection.post(
|
93
|
+
'contacts/email/tags/delete', "email=#{email}&tags=#{tags}",
|
94
|
+
'content-type' => 'application/x-www-form-urlencoded'
|
95
|
+
)
|
96
|
+
self.tags = self.tags - tags if response.status == 204
|
97
|
+
end
|
98
|
+
|
90
99
|
def notes
|
91
100
|
response = AgileCRMWrapper.connection.get("contacts/#{id}/notes")
|
92
101
|
response.body.map { |note| AgileCRMWrapper::Note.new(note) }
|
@@ -35,6 +35,14 @@ describe AgileCRMWrapper::Contact do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe '#delete_tags' do
|
39
|
+
it 'removes the tags' do
|
40
|
+
expect(
|
41
|
+
contact.delete_tags(contact.tags)
|
42
|
+
).to eq []
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
38
46
|
describe '.search_by_email' do
|
39
47
|
let(:email) { 'anitadrink@example.com' }
|
40
48
|
subject { AgileCRMWrapper::Contact.search_by_email(email) }
|
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.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -203,7 +203,6 @@ files:
|
|
203
203
|
- ".rspec"
|
204
204
|
- ".rubocop.yml"
|
205
205
|
- Gemfile
|
206
|
-
- Gemfile.lock
|
207
206
|
- LICENSE
|
208
207
|
- README.md
|
209
208
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
agilecrm-wrapper (1.0.2)
|
5
|
-
faraday (~> 0.9)
|
6
|
-
faraday_middleware
|
7
|
-
hashie
|
8
|
-
json
|
9
|
-
|
10
|
-
GEM
|
11
|
-
remote: https://rubygems.org/
|
12
|
-
specs:
|
13
|
-
addressable (2.3.6)
|
14
|
-
ast (2.0.0)
|
15
|
-
astrolabe (1.3.0)
|
16
|
-
parser (>= 2.2.0.pre.3, < 3.0)
|
17
|
-
awesome_print (1.2.0)
|
18
|
-
coderay (1.1.0)
|
19
|
-
crack (0.4.2)
|
20
|
-
safe_yaml (~> 1.0.0)
|
21
|
-
diff-lcs (1.2.5)
|
22
|
-
faraday (0.9.0)
|
23
|
-
multipart-post (>= 1.2, < 3)
|
24
|
-
faraday_middleware (0.9.1)
|
25
|
-
faraday (>= 0.7.4, < 0.10)
|
26
|
-
hashie (3.3.2)
|
27
|
-
json (1.8.2)
|
28
|
-
method_source (0.8.2)
|
29
|
-
multipart-post (2.0.0)
|
30
|
-
parser (2.2.0.pre.5)
|
31
|
-
ast (>= 1.1, < 3.0)
|
32
|
-
slop (~> 3.4, >= 3.4.5)
|
33
|
-
powerpack (0.0.9)
|
34
|
-
pry (0.10.1)
|
35
|
-
coderay (~> 1.1.0)
|
36
|
-
method_source (~> 0.8.1)
|
37
|
-
slop (~> 3.4)
|
38
|
-
rack (1.5.2)
|
39
|
-
rack-protection (1.5.3)
|
40
|
-
rack
|
41
|
-
rainbow (2.0.0)
|
42
|
-
rake (10.3.2)
|
43
|
-
rspec (3.1.0)
|
44
|
-
rspec-core (~> 3.1.0)
|
45
|
-
rspec-expectations (~> 3.1.0)
|
46
|
-
rspec-mocks (~> 3.1.0)
|
47
|
-
rspec-core (3.1.5)
|
48
|
-
rspec-support (~> 3.1.0)
|
49
|
-
rspec-expectations (3.1.2)
|
50
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
51
|
-
rspec-support (~> 3.1.0)
|
52
|
-
rspec-its (1.0.1)
|
53
|
-
rspec-core (>= 2.99.0.beta1)
|
54
|
-
rspec-expectations (>= 2.99.0.beta1)
|
55
|
-
rspec-mocks (3.1.2)
|
56
|
-
rspec-support (~> 3.1.0)
|
57
|
-
rspec-support (3.1.1)
|
58
|
-
rubocop (0.26.1)
|
59
|
-
astrolabe (~> 1.3)
|
60
|
-
parser (>= 2.2.0.pre.4, < 3.0)
|
61
|
-
powerpack (~> 0.0.6)
|
62
|
-
rainbow (>= 1.99.1, < 3.0)
|
63
|
-
ruby-progressbar (~> 1.4)
|
64
|
-
ruby-progressbar (1.6.0)
|
65
|
-
safe_yaml (1.0.4)
|
66
|
-
sinatra (1.4.5)
|
67
|
-
rack (~> 1.4)
|
68
|
-
rack-protection (~> 1.4)
|
69
|
-
tilt (~> 1.3, >= 1.3.4)
|
70
|
-
slop (3.6.0)
|
71
|
-
tilt (1.4.1)
|
72
|
-
webmock (1.19.0)
|
73
|
-
addressable (>= 2.3.6)
|
74
|
-
crack (>= 0.3.2)
|
75
|
-
|
76
|
-
PLATFORMS
|
77
|
-
ruby
|
78
|
-
|
79
|
-
DEPENDENCIES
|
80
|
-
agilecrm-wrapper!
|
81
|
-
awesome_print
|
82
|
-
bundler (~> 1.6)
|
83
|
-
pry
|
84
|
-
rake
|
85
|
-
rspec
|
86
|
-
rspec-its
|
87
|
-
rubocop
|
88
|
-
sinatra
|
89
|
-
webmock
|