crunchbase4 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -0
- data/lib/crunchbase/utilities/search_query_parameters.rb +44 -16
- 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: b2e94aa6bd2ebe2d92291b2566572e4436e65c9562ee8425d26b50917e926f2f
|
4
|
+
data.tar.gz: e44770e8b5d92ecbc2a9deda44007d51aaf63038ffaf2127b1e58852b07b5d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d808d02e7619ffaba3990f79d989974361d6233d6fdebd8260cfc6eaed68bf34477d761a919defa0346e5aad9b1b1b9810752316d879a3fcc1cbeb599faea0d
|
7
|
+
data.tar.gz: 66dbd1d99bb4c0c052a511264e2e424f26ff09ff4d1d7bc3a9abb57748561a5c13c99823677843555fafd9ad24f0c41fc518fb0223aebc3a63d06f249984d0ba
|
data/Gemfile.lock
CHANGED
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
|
|
@@ -27,33 +27,33 @@ module Crunchbase
|
|
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
|
30
|
+
order_conditions = order_field_ids.map do |field_id|
|
31
|
+
{
|
32
|
+
'field_id' => field_id,
|
33
|
+
'sort' => (args[:sort] || 'desc'),
|
34
|
+
'nulls' => 'last'
|
35
|
+
}
|
36
|
+
end
|
31
37
|
|
32
38
|
params = {
|
33
39
|
'field_ids' => default_field_ids + (args[:field_ids] || []).uniq,
|
34
40
|
'order' => order_conditions,
|
35
41
|
'limit' => args[:limit] || 1000
|
36
42
|
}
|
37
|
-
|
38
|
-
unless args[:date].nil?
|
39
|
-
params.merge!(
|
40
|
-
'query' => [
|
41
|
-
{
|
42
|
-
'type' => 'predicate',
|
43
|
-
'field_id' => order_field_ids[0],
|
44
|
-
'operator_id' => 'gte',
|
45
|
-
'values' => [
|
46
|
-
args[:date]
|
47
|
-
]
|
48
|
-
}
|
49
|
-
]
|
50
|
-
)
|
51
|
-
end
|
43
|
+
# Pagination
|
52
44
|
params['before_id'] = args[:before_id] unless args[:before_id].nil?
|
53
45
|
params['after_id'] = args[:after_id] unless args[:after_id].nil?
|
46
|
+
|
47
|
+
# Date Ranges
|
48
|
+
unless (queries = build_predicate_queries(args, order_field_ids)).empty?
|
49
|
+
params['query'] = queries
|
50
|
+
end
|
51
|
+
|
54
52
|
params
|
55
53
|
end
|
56
54
|
|
55
|
+
private
|
56
|
+
|
57
57
|
def default_field_ids
|
58
58
|
@default_field_ids ||= %w[
|
59
59
|
uuid
|
@@ -61,6 +61,34 @@ module Crunchbase
|
|
61
61
|
updated_at
|
62
62
|
]
|
63
63
|
end
|
64
|
+
|
65
|
+
def build_predicate_queries(args, order_field_ids)
|
66
|
+
# Date Ranges
|
67
|
+
queries = []
|
68
|
+
if !args[:date].nil? || !args[:from_date].nil?
|
69
|
+
queries << {
|
70
|
+
'type' => 'predicate',
|
71
|
+
'field_id' => order_field_ids[0],
|
72
|
+
'operator_id' => 'gte',
|
73
|
+
'values' => [
|
74
|
+
args[:date] || args[:from_date]
|
75
|
+
]
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
unless args[:to_date].nil?
|
80
|
+
queries << {
|
81
|
+
'type' => 'predicate',
|
82
|
+
'field_id' => order_field_ids[0],
|
83
|
+
'operator_id' => 'lte',
|
84
|
+
'values' => [
|
85
|
+
args[:to_date]
|
86
|
+
]
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
queries
|
91
|
+
end
|
64
92
|
end
|
65
93
|
end
|
66
94
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Encore Shao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|