agilecrm-wrapper 1.0.2 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f8164dd410e9b3170832a19d196f36341392189
4
- data.tar.gz: 796ffe45dc8617ac270eb481d3d967205415255f
3
+ metadata.gz: f4021786d7a9dfad0f80f6cf54de5744a5fa8696
4
+ data.tar.gz: cd4723ed8726d2b9b6a3f97dd085d67c85fe7fc3
5
5
  SHA512:
6
- metadata.gz: 83ccfe9651395b4d22e178d7cdcecaba597380cf6004e65d3e735d8e69566d060e785e6b2be1258bdd356c2fad758b5b11e91c7a12851b1ce9035ee6938841a3
7
- data.tar.gz: 790244c1538b85d322466d6d39b5060e86c9592550c4cec600e5bce9c7b56c0511e2641c06d989eb99db68c77843b69c8a91523ec8ec7b2a311240fce9157640
6
+ metadata.gz: 2bf8f1656e67dd9ef1f6a620139becabff21f401d3caa9c28fd94a5ea5f1ac0895136abbd76657d2b1b3328b865b2e151c2ed6cd2e96744ee461cb22c7d3f676
7
+ data.tar.gz: 886187ae5a984890bc01ebb37baec00bb03cca43dc7d0d59a0c976bb60be2ffcbeb2f3d5709f79aeb9cb384f025a00c1d86825002a611e8b78621f944ceca49c
data/README.md CHANGED
@@ -109,6 +109,12 @@ AgileCRMWrapper::Note.add_by_email(
109
109
  )
110
110
  ```
111
111
 
112
+ ### 3. Working with Tags
113
+
114
+ ##### List all tags
115
+ ```ruby
116
+ AgileCRMWrapper::Tag.all #=> [...]
117
+ ```
112
118
 
113
119
  ## Contributing
114
120
 
@@ -5,6 +5,7 @@ require 'agilecrm-wrapper/version'
5
5
  require 'agilecrm-wrapper/configuration'
6
6
  require 'agilecrm-wrapper/contact'
7
7
  require 'agilecrm-wrapper/note'
8
+ require 'agilecrm-wrapper/tag'
8
9
  require 'agilecrm-wrapper/response/raise_error'
9
10
 
10
11
  module AgileCRMWrapper
@@ -0,0 +1,22 @@
1
+ require 'agilecrm-wrapper/error'
2
+ require 'hashie'
3
+
4
+ module AgileCRMWrapper
5
+ class Tag < Hashie::Mash
6
+ class << self
7
+
8
+ ##
9
+ # Get all tags
10
+ # `AgileCRMWrapper::Tag.all`
11
+
12
+ def all
13
+ response = AgileCRMWrapper.connection.get('tags')
14
+ if response.status == 200
15
+ return response.body.map { |body| new body }
16
+ else
17
+ return response
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module AgileCRMWrapper
2
- VERSION = '1.0.2'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AgileCRMWrapper::Tag do
4
+ describe '.all' do
5
+ subject { AgileCRMWrapper::Tag.all }
6
+
7
+ it 'should return an array of Tags' do
8
+ expect(subject.map(&:class).uniq).to eq([AgileCRMWrapper::Tag])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "tag": "Agile",
4
+ "createdTime": 0,
5
+ "availableCount": 0,
6
+ "entity_type": "tag"
7
+ },
8
+ {
9
+ "tag": "tag1",
10
+ "createdTime": 0,
11
+ "availableCount": 0,
12
+ "entity_type": "tag"
13
+ },
14
+ {
15
+ "tag": "tag2",
16
+ "createdTime": 0,
17
+ "availableCount": 0,
18
+ "entity_type": "tag"
19
+ },
20
+ {
21
+ "tag": "tag3",
22
+ "createdTime": 0,
23
+ "availableCount": 0,
24
+ "entity_type": "tag"
25
+ },
26
+ {
27
+ "tag": "tag4",
28
+ "createdTime": 0,
29
+ "availableCount": 0,
30
+ "entity_type": "tag"
31
+ },
32
+ {
33
+ "tag": "tag5",
34
+ "createdTime": 0,
35
+ "availableCount": 0,
36
+ "entity_type": "tag"
37
+ }
38
+ ]
@@ -46,6 +46,10 @@ class FakeAgileCRM < Sinatra::Base
46
46
  status 204
47
47
  end
48
48
 
49
+ get '/dev/api/tags' do
50
+ json_response 200, 'tags', 'list_tags'
51
+ end
52
+
49
53
  private
50
54
 
51
55
  def json_response(response_code, resource, file_name)
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.2
4
+ version: 1.1.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-03-25 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -214,10 +214,12 @@ files:
214
214
  - lib/agilecrm-wrapper/error.rb
215
215
  - lib/agilecrm-wrapper/note.rb
216
216
  - lib/agilecrm-wrapper/response/raise_error.rb
217
+ - lib/agilecrm-wrapper/tag.rb
217
218
  - lib/agilecrm-wrapper/version.rb
218
219
  - spec/agilecrm-wrapper/agilecrm_wrapper_spec.rb
219
220
  - spec/agilecrm-wrapper/contact_spec.rb
220
221
  - spec/agilecrm-wrapper/note_spec.rb
222
+ - spec/agilecrm-wrapper/tag_spec.rb
221
223
  - spec/fixtures/contacts/create_contact.json
222
224
  - spec/fixtures/contacts/get_contact.json
223
225
  - spec/fixtures/contacts/get_contact_notes.json
@@ -227,6 +229,7 @@ files:
227
229
  - spec/fixtures/contacts/updated_contact.json
228
230
  - spec/fixtures/notes/create_note.json
229
231
  - spec/fixtures/notes/create_without_contact.json
232
+ - spec/fixtures/tags/list_tags.json
230
233
  - spec/spec_helper.rb
231
234
  - spec/support/fake_agilecrm.rb
232
235
  homepage: https://github.com/nozpheratu/agilecrm-wrapper
@@ -249,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
252
  version: '0'
250
253
  requirements: []
251
254
  rubyforge_project:
252
- rubygems_version: 2.2.2
255
+ rubygems_version: 2.4.6
253
256
  signing_key:
254
257
  specification_version: 4
255
258
  summary: Ruby wrapper for Agile CRM API.
@@ -257,6 +260,7 @@ test_files:
257
260
  - spec/agilecrm-wrapper/agilecrm_wrapper_spec.rb
258
261
  - spec/agilecrm-wrapper/contact_spec.rb
259
262
  - spec/agilecrm-wrapper/note_spec.rb
263
+ - spec/agilecrm-wrapper/tag_spec.rb
260
264
  - spec/fixtures/contacts/create_contact.json
261
265
  - spec/fixtures/contacts/get_contact.json
262
266
  - spec/fixtures/contacts/get_contact_notes.json
@@ -266,5 +270,7 @@ test_files:
266
270
  - spec/fixtures/contacts/updated_contact.json
267
271
  - spec/fixtures/notes/create_note.json
268
272
  - spec/fixtures/notes/create_without_contact.json
273
+ - spec/fixtures/tags/list_tags.json
269
274
  - spec/spec_helper.rb
270
275
  - spec/support/fake_agilecrm.rb
276
+ has_rdoc: