contactually-api 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/contactually/contacts.rb +4 -0
- data/lib/contactually/version.rb +1 -1
- data/spec/contacts_spec.rb +13 -0
- 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: 4fbd568f84f185d43c65db4620bb4769007ce5d0
|
4
|
+
data.tar.gz: 69bf0347f6016fd4e52aaaed384ad3f071940040
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/contactually/version.rb
CHANGED
data/spec/contacts_spec.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|