crunchbase4 0.2.2 → 0.2.5
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/Gemfile.lock +20 -2
- data/README.md +12 -0
- data/lib/crunchbase/searches/client.rb +3 -1
- data/lib/crunchbase/utilities/search_query_parameters.rb +41 -18
- data/lib/crunchbase/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5364cb9aabb82ee80de4b80201a09d64e6f5734b09387f61645a0b46baf28c6
|
4
|
+
data.tar.gz: 2a7dcd16421ee17bda69bdaca71c4dbd5c0fa744af83f7de846e9ec70d9ba5ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9b72b41e01a1eea4b5826d54203a5f780bc2a5cd598c4a9a12d27b887740800e5d4b96458511cc8882710476125ed326615cc2feabc557163164e9b099e9448
|
7
|
+
data.tar.gz: 7ffb3c67fc3f604c3e360032ce6d9beca8616c9a827fea484fb5a6aa236bcf45b5862dce2aaf589558ec589fe2fbabc9480874422d3634842bfed9a535237be9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
crunchbase4 (0.2.
|
4
|
+
crunchbase4 (0.2.5)
|
5
5
|
faraday
|
6
6
|
faraday_curl
|
7
7
|
faraday_middleware
|
@@ -17,8 +17,25 @@ GEM
|
|
17
17
|
crack (0.4.3)
|
18
18
|
safe_yaml (~> 1.0.0)
|
19
19
|
diff-lcs (1.5.0)
|
20
|
-
faraday (1.0
|
20
|
+
faraday (1.8.0)
|
21
|
+
faraday-em_http (~> 1.0)
|
22
|
+
faraday-em_synchrony (~> 1.0)
|
23
|
+
faraday-excon (~> 1.1)
|
24
|
+
faraday-httpclient (~> 1.0.1)
|
25
|
+
faraday-net_http (~> 1.0)
|
26
|
+
faraday-net_http_persistent (~> 1.1)
|
27
|
+
faraday-patron (~> 1.0)
|
28
|
+
faraday-rack (~> 1.0)
|
21
29
|
multipart-post (>= 1.2, < 3)
|
30
|
+
ruby2_keywords (>= 0.0.4)
|
31
|
+
faraday-em_http (1.0.0)
|
32
|
+
faraday-em_synchrony (1.0.0)
|
33
|
+
faraday-excon (1.1.0)
|
34
|
+
faraday-httpclient (1.0.1)
|
35
|
+
faraday-net_http (1.0.1)
|
36
|
+
faraday-net_http_persistent (1.2.0)
|
37
|
+
faraday-patron (1.0.0)
|
38
|
+
faraday-rack (1.0.0)
|
22
39
|
faraday_curl (0.0.2)
|
23
40
|
faraday (>= 0.9.0)
|
24
41
|
faraday_middleware (1.2.0)
|
@@ -64,6 +81,7 @@ GEM
|
|
64
81
|
ruby-progressbar (~> 1.7)
|
65
82
|
unicode-display_width (>= 1.4.0, < 2.0)
|
66
83
|
ruby-progressbar (1.10.1)
|
84
|
+
ruby2_keywords (0.0.5)
|
67
85
|
safe_yaml (1.0.5)
|
68
86
|
unicode-display_width (1.7.0)
|
69
87
|
vcr (6.0.0)
|
data/README.md
CHANGED
@@ -433,6 +433,18 @@ args = {
|
|
433
433
|
after_id: 'uuid' # optional
|
434
434
|
}
|
435
435
|
|
436
|
+
response = client.recent_updates(args)
|
437
|
+
|
438
|
+
args = {
|
439
|
+
scope_name: 'press_reference', # must
|
440
|
+
from_date: '2020-05-05', # optional
|
441
|
+
to_date: '2020-05-05', # optional
|
442
|
+
field_ids: %w[title posted_on publisher], # default %[uuid created_at updated_at]
|
443
|
+
sort: 'desc' # default `desc`
|
444
|
+
before_id: 'uuid' # optional
|
445
|
+
after_id: 'uuid' # optional
|
446
|
+
}
|
447
|
+
|
436
448
|
response = client.recent_updates(args)
|
437
449
|
```
|
438
450
|
|
@@ -73,8 +73,10 @@ module Crunchbase
|
|
73
73
|
'field_ids' => field_ids,
|
74
74
|
'order' => @conditions['order'],
|
75
75
|
'query' => @conditions['query'],
|
76
|
+
'before_id' => @conditions['before_id'],
|
77
|
+
'after_id' => @conditions['after_id'],
|
76
78
|
'limit' => limit
|
77
|
-
}
|
79
|
+
}.delete_if { |_, v| v.nil? }
|
78
80
|
end
|
79
81
|
end
|
80
82
|
end
|
@@ -11,7 +11,7 @@ module Crunchbase
|
|
11
11
|
#
|
12
12
|
# Search Query Parameters
|
13
13
|
#
|
14
|
-
#
|
14
|
+
# order_field_ids: sort field, default field will be updated_at
|
15
15
|
# field_ids: array of field_id strings
|
16
16
|
# Fields to include as columns in the search result entities
|
17
17
|
# query: Search query to perform on the designated entity
|
@@ -26,33 +26,28 @@ module Crunchbase
|
|
26
26
|
# Used to paginate search results to the next page.
|
27
27
|
# after_id should be the uuid of the last item in the current page. May not be provided simultaneously with before_id.
|
28
28
|
def query_parameters(args)
|
29
|
-
|
29
|
+
order_field_ids = args[:order_field_ids] || ['updated_at']
|
30
|
+
order_conditions = order_field_ids.map { |field_id| { 'field_id' => field_id, 'sort' => (args[:sort] || 'desc'), 'nulls' => 'last' } }
|
30
31
|
|
31
32
|
params = {
|
32
33
|
'field_ids' => default_field_ids + (args[:field_ids] || []).uniq,
|
33
|
-
'order' =>
|
34
|
+
'order' => order_conditions,
|
34
35
|
'limit' => args[:limit] || 1000
|
35
36
|
}
|
37
|
+
# Pagination
|
38
|
+
params['before_id'] = args[:before_id] unless args[:before_id].nil?
|
39
|
+
params['after_id'] = args[:after_id] unless args[:after_id].nil?
|
36
40
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
{
|
41
|
-
'type' => 'predicate',
|
42
|
-
'field_id' => order_field_id,
|
43
|
-
'operator_id' => 'gte',
|
44
|
-
'values' => [
|
45
|
-
args[:date]
|
46
|
-
]
|
47
|
-
}
|
48
|
-
]
|
49
|
-
)
|
41
|
+
# Date Ranges
|
42
|
+
unless (queries = build_predicate_queries(args, order_field_ids)).empty?
|
43
|
+
params['query'] = queries
|
50
44
|
end
|
51
|
-
|
52
|
-
params.merge!('after_id' => args[:after_id]) unless args[:after_id].nil?
|
45
|
+
|
53
46
|
params
|
54
47
|
end
|
55
48
|
|
49
|
+
private
|
50
|
+
|
56
51
|
def default_field_ids
|
57
52
|
@default_field_ids ||= %w[
|
58
53
|
uuid
|
@@ -60,6 +55,34 @@ module Crunchbase
|
|
60
55
|
updated_at
|
61
56
|
]
|
62
57
|
end
|
58
|
+
|
59
|
+
def build_predicate_queries(args, order_field_ids)
|
60
|
+
# Date Ranges
|
61
|
+
queries = []
|
62
|
+
if !args[:date].nil? || !args[:from_date].nil?
|
63
|
+
queries << {
|
64
|
+
'type' => 'predicate',
|
65
|
+
'field_id' => order_field_ids[0],
|
66
|
+
'operator_id' => 'gte',
|
67
|
+
'values' => [
|
68
|
+
args[:date] || args[:from_date]
|
69
|
+
]
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
unless args[:to_date].nil?
|
74
|
+
queries << {
|
75
|
+
'type' => 'predicate',
|
76
|
+
'field_id' => order_field_ids[0],
|
77
|
+
'operator_id' => 'lte',
|
78
|
+
'values' => [
|
79
|
+
args[:to_date]
|
80
|
+
]
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
queries
|
85
|
+
end
|
63
86
|
end
|
64
87
|
end
|
65
88
|
end
|
data/lib/crunchbase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crunchbase4
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|