contactually-api 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cd7a2066d2e464a598894a236dd4fc7e640fd8c
4
- data.tar.gz: 54231ef13bfc48b4ca4f05a43839efc4e04bb39c
3
+ metadata.gz: 4fbd568f84f185d43c65db4620bb4769007ce5d0
4
+ data.tar.gz: 69bf0347f6016fd4e52aaaed384ad3f071940040
5
5
  SHA512:
6
- metadata.gz: 721a6a77ee10988644909cf9f917e40be57d1d535785cd01becc3dfe9426cdf0caea3eb62e47f9bf5468507ff1ab4941c2de761f1f3672c9e2b065f969318b4a
7
- data.tar.gz: 3501748db20d7c4742549dfd60187047f1e83ae1dd6ba6039823e69b0fca76dd0d8e1560dfac31d332a16dbbec1b42366b9a4635d13991e461a14b305fb39f13
6
+ metadata.gz: ee32c68f6da74fd6c8bfe82cf292ba056347c2f36356804c36ea69678063a399b29f12b82dd536c9b834a6a07d2569ae4e55fa4dd59113f9b46aee61e04546e9
7
+ data.tar.gz: fb3751429768b327bdfb36df809df1acd1b9fe5e36e6de5dfc76facbc855c0e5229e05ae9980617b4c76a83e9a06d864d0cc07eafd85f6f6e0fd2b44b8d1ff6c
@@ -46,5 +46,9 @@ module Contactually
46
46
  hash = @master.call('contacts/search.json', :get, params)
47
47
  Contactually::Utils.contacts_hash_to_objects(hash)
48
48
  end
49
+
50
+ def count(params = { limit: 1 })
51
+ @master.call('contacts.json', :get, params)["total_count"]
52
+ end
49
53
  end
50
54
  end
@@ -1,3 +1,3 @@
1
1
  module Contactually
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -117,4 +117,17 @@ describe Contactually::Contacts do
117
117
  expect(subject.search({ term: :foo_bar })[0]).to be_kind_of Contactually::Contact
118
118
  end
119
119
  end
120
+
121
+ describe '#count' do
122
+ it 'calls the api with correct params' do
123
+ allow(@master).to receive(:call).with('contacts.json', :get, { limit: 1 }).and_return({ 'contacts' => [], 'total_count' => 120 })
124
+ subject.count()
125
+ expect(@master).to have_received(:call)
126
+ end
127
+
128
+ it 'returns total count' do
129
+ allow(@master).to receive(:call).with('contacts.json', :get, { limit: 1 }).and_return({ 'contacts' => [], 'total_count' => 120 })
130
+ expect(subject.count).to be 120
131
+ end
132
+ end
120
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contactually-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Heck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport