closeio 2.0.6 → 2.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 +4 -4
- data/lib/closeio/client.rb +15 -0
- data/lib/closeio/resources/lead.rb +6 -2
- data/lib/closeio/version.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: 8c6f70c84e49c2967466fd69a8c7829e1036e612
|
4
|
+
data.tar.gz: 217f7e8be34329b4ab04a364b3357dfe1ae21fa1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4083aabdaa2957a779b9455a13a569dd20160433fd6b721327ea45997bbb3f88932fd196d0deb2697398aebea23cf2b84483dbb589c0afcf9822948dd9722448
|
7
|
+
data.tar.gz: cb110ad5a3fe1cdfea8818284ab884f70914aba984603269c494b93ec566f20b4b4db1fbbdacc92fb05d34aaedc2006a82396ddddfd15763e26a57d923093875
|
data/lib/closeio/client.rb
CHANGED
@@ -45,7 +45,22 @@ module Closeio
|
|
45
45
|
connection.delete(path, options).body
|
46
46
|
end
|
47
47
|
|
48
|
+
def paginate(path, options)
|
49
|
+
results = []
|
50
|
+
skip = 0
|
51
|
+
|
52
|
+
begin
|
53
|
+
res = get(lead_path, options.merge!(_skip: skip))
|
54
|
+
results.push res.data
|
55
|
+
skip += res.data.count
|
56
|
+
end while res.has_more
|
57
|
+
json = {has_more: false, total_results: res.total_results, data: results.flatten}
|
58
|
+
Hashie::Mash.new json
|
59
|
+
end
|
60
|
+
|
48
61
|
private
|
62
|
+
|
63
|
+
|
49
64
|
def connection
|
50
65
|
Faraday.new(url: "https://app.close.io/api/v1", headers: { accept: 'application/json' }) do |connection|
|
51
66
|
connection.basic_auth api_key, ''
|
@@ -2,8 +2,12 @@ module Closeio
|
|
2
2
|
class Client
|
3
3
|
module Lead
|
4
4
|
|
5
|
-
def list_leads(options = {})
|
6
|
-
|
5
|
+
def list_leads(options = {}, paginate = false)
|
6
|
+
if paginate
|
7
|
+
paginate(lead_path, query: options)
|
8
|
+
else
|
9
|
+
get(lead_path, query: options)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
|
9
13
|
def find_lead(id)
|
data/lib/closeio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: closeio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|