crunchbase4 0.2.1 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 971654d5b778699371f2018a2875e6e463568ac74594fa7538ea3631eab06a5f
4
- data.tar.gz: 1841c00ac046c7ee260fd19acfce5201c3ae18ee5e1950f2394ea99637827955
3
+ metadata.gz: ce0e0ef863b2ccbcdf683719fb8a36ba0a900208e1a6ff13a69b6c8f7f6acd90
4
+ data.tar.gz: 4ec2bfcea56efe70cff7e9831de381b46fb5fb0811db889dd70fb17c111f393c
5
5
  SHA512:
6
- metadata.gz: fce7337167a7315926f1200a24019d9edf90418d9a29a877c273573b8522d836ce28ae75bd8b3c34ec633e5becbb547eac231da8d80f2a9f2cde30a5af66f496
7
- data.tar.gz: 0440b78a9dcb051757b313cab629db2dd1a8e3cedc20a46e4cea88e881f599ec1408c7acf87320de08ed01e71cbf5054533d2d0c3de53316a995e3da1a21d42a
6
+ metadata.gz: 4b84de4848db6f199c01a30f6f36111abc0ce26e11d1dc81c64c229be4c5e405cbe403c05ba8021361088da78dd5c1a7806a1d0d251b0e7f9851d2fef492df6a
7
+ data.tar.gz: 88d4857e5118750877df2c3a4e0833f0c44d5b1c04dbad092b5771c56e1ec1177d639817f50bd9f29cdaedb5e9ddbe5e5b5043a7d8bec6bb3e2cc5ebb1454367
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crunchbase4 (0.2.1)
4
+ crunchbase4 (0.2.4)
5
5
  faraday
6
6
  faraday_curl
7
7
  faraday_middleware
@@ -16,7 +16,7 @@ GEM
16
16
  coderay (1.1.3)
17
17
  crack (0.4.3)
18
18
  safe_yaml (~> 1.0.0)
19
- diff-lcs (1.3)
19
+ diff-lcs (1.5.0)
20
20
  faraday (1.8.0)
21
21
  faraday-em_http (~> 1.0)
22
22
  faraday-em_synchrony (~> 1.0)
@@ -41,57 +41,52 @@ GEM
41
41
  faraday_middleware (1.2.0)
42
42
  faraday (~> 1.0)
43
43
  hashdiff (1.0.1)
44
- httparty (0.20.0)
45
- mime-types (~> 3.0)
44
+ httparty (0.21.0)
45
+ mini_mime (>= 1.0.0)
46
46
  multi_xml (>= 0.5.2)
47
+ jaro_winkler (1.5.4)
47
48
  method_source (1.0.0)
48
- mime-types (3.3.1)
49
- mime-types-data (~> 3.2015)
50
- mime-types-data (3.2021.0901)
49
+ mini_mime (1.1.2)
51
50
  multi_xml (0.6.0)
52
51
  multipart-post (2.1.1)
53
- parallel (1.19.1)
52
+ parallel (1.19.2)
54
53
  parser (2.7.1.3)
55
54
  ast (~> 2.4.0)
56
- pry (0.13.1)
55
+ pry (0.14.1)
57
56
  coderay (~> 1.1)
58
57
  method_source (~> 1.0)
59
58
  public_suffix (4.0.6)
60
- rainbow (3.0.0)
59
+ rainbow (3.1.1)
61
60
  rake (12.3.3)
62
- regexp_parser (1.7.0)
63
61
  rexml (3.2.5)
64
62
  rspec (3.9.0)
65
63
  rspec-core (~> 3.9.0)
66
64
  rspec-expectations (~> 3.9.0)
67
65
  rspec-mocks (~> 3.9.0)
68
- rspec-core (3.9.2)
66
+ rspec-core (3.9.3)
69
67
  rspec-support (~> 3.9.3)
70
- rspec-expectations (3.9.2)
68
+ rspec-expectations (3.9.4)
71
69
  diff-lcs (>= 1.2.0, < 2.0)
72
70
  rspec-support (~> 3.9.0)
73
71
  rspec-mocks (3.9.1)
74
72
  diff-lcs (>= 1.2.0, < 2.0)
75
73
  rspec-support (~> 3.9.0)
76
74
  rspec-support (3.9.3)
77
- rubocop (0.85.0)
75
+ rubocop (0.81.0)
76
+ jaro_winkler (~> 1.5.1)
78
77
  parallel (~> 1.10)
79
78
  parser (>= 2.7.0.1)
80
79
  rainbow (>= 2.2.2, < 4.0)
81
- regexp_parser (>= 1.7)
82
80
  rexml
83
- rubocop-ast (>= 0.0.3)
84
81
  ruby-progressbar (~> 1.7)
85
82
  unicode-display_width (>= 1.4.0, < 2.0)
86
- rubocop-ast (0.0.3)
87
- parser (>= 2.7.0.1)
88
83
  ruby-progressbar (1.10.1)
89
84
  ruby2_keywords (0.0.5)
90
85
  safe_yaml (1.0.5)
91
86
  unicode-display_width (1.7.0)
92
87
  vcr (6.0.0)
93
- webmock (3.8.3)
94
- addressable (>= 2.3.6)
88
+ webmock (3.18.1)
89
+ addressable (>= 2.8.0)
95
90
  crack (>= 0.3.2)
96
91
  hashdiff (>= 0.4.0, < 2.0.0)
97
92
 
@@ -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,6 +11,7 @@ module Crunchbase
11
11
  #
12
12
  # Search Query Parameters
13
13
  #
14
+ # order_field_ids: sort field, default field will be updated_at
14
15
  # field_ids: array of field_id strings
15
16
  # Fields to include as columns in the search result entities
16
17
  # query: Search query to perform on the designated entity
@@ -25,19 +26,12 @@ module Crunchbase
25
26
  # Used to paginate search results to the next page.
26
27
  # after_id should be the uuid of the last item in the current page. May not be provided simultaneously with before_id.
27
28
  def query_parameters(args)
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' } }
31
+
28
32
  params = {
29
- 'field_ids' => %w[
30
- uuid
31
- created_at
32
- updated_at
33
- ] + (args[:field_ids] || []).uniq,
34
- 'order' => [
35
- {
36
- 'field_id' => 'updated_at',
37
- 'sort' => (args[:sort] || 'desc'),
38
- 'nulls' => 'last'
39
- }
40
- ],
33
+ 'field_ids' => default_field_ids + (args[:field_ids] || []).uniq,
34
+ 'order' => order_conditions,
41
35
  'limit' => args[:limit] || 1000
42
36
  }
43
37
 
@@ -46,7 +40,7 @@ module Crunchbase
46
40
  'query' => [
47
41
  {
48
42
  'type' => 'predicate',
49
- 'field_id' => 'updated_at',
43
+ 'field_id' => order_field_ids[0],
50
44
  'operator_id' => 'gte',
51
45
  'values' => [
52
46
  args[:date]
@@ -55,10 +49,18 @@ module Crunchbase
55
49
  ]
56
50
  )
57
51
  end
58
- params.merge!('before_id' => args[:before_id]) unless args[:before_id].nil?
59
- params.merge!('after_id' => args[:after_id]) unless args[:after_id].nil?
52
+ params['before_id'] = args[:before_id] unless args[:before_id].nil?
53
+ params['after_id'] = args[:after_id] unless args[:after_id].nil?
60
54
  params
61
55
  end
56
+
57
+ def default_field_ids
58
+ @default_field_ids ||= %w[
59
+ uuid
60
+ created_at
61
+ updated_at
62
+ ]
63
+ end
62
64
  end
63
65
  end
64
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Crunchbase
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.4'
5
5
  end
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.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Encore Shao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-10 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday