connectors_sdk 8.2.3.0 → 8.3.0.0.pre.20220414T060419Z

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: 4c9444e4767b3968419c0810181da18254e8af904ab230ed7f52013f765365f5
4
- data.tar.gz: 51bce284b26ed688847c14fc81766272ce6a3ac23fae3934921e19e0e51a7817
3
+ metadata.gz: a44a80ba5fe5032b6254fb8a2db25516542df5818044d627b6ba31f652a7812f
4
+ data.tar.gz: 52d1245cc24ab6e1a42c00483ec4a8ece48ede4a6465c9b46b3bf5e18c979678
5
5
  SHA512:
6
- metadata.gz: ee7e9f2217b4d15db1567084f3642951b7d7ab8219f85b4377e26bfb38836dcbd5de986ec5847e1aae42165e8537fb83db20f16acdacb3cb56557e32a5dcafe1
7
- data.tar.gz: 2c06c724cf5e0f993580d891c3392b284fc211ca925d2ddcf33feb89d5150f1976472b54ffd9b10acde88063044f4d94c60c6c2b6d331bab276e8a70f509d7f9
6
+ metadata.gz: 7a4021e1d7b83ec7334913f1ef5e684e02296097f223e96610cb31eb5502c36f9b45b03eeaf80e876aac5bcc531f85d10445917459b86cedc30d6609b33f5351
7
+ data.tar.gz: ca04ab72f48ed6e76b3a0e0cc8c260f81779ea906325a782eb61456c9c5be231043d7a73ca9625df63459460de587c65aa352fb2e1150fc8c92a253536fcd634
@@ -17,8 +17,8 @@ module ConnectorsSdk
17
17
  @connectors[name] = klass
18
18
  end
19
19
 
20
- def connector_class(name)
21
- @connectors[name]
20
+ def connector(name)
21
+ @connectors[name].new
22
22
  end
23
23
  end
24
24
 
@@ -125,7 +125,7 @@ module ConnectorsSdk
125
125
  yielded = 0
126
126
  while stack.any?
127
127
  folder_id = stack.pop
128
- item_children(drive_id, folder_id, :fields => fields_with_id, :break_after_page => break_after_page) do |item|
128
+ item_children(drive_id, folder_id, :fields => fields_with_id) do |item|
129
129
  if item.folder
130
130
  stack << item.id
131
131
  end
@@ -134,14 +134,9 @@ module ConnectorsSdk
134
134
  yielded += 1
135
135
  end
136
136
 
137
- if break_after_page && yielded >= 100
138
- if cursors['item_children_next_link'].present?
139
- stack << folder_id
140
- end
141
- if stack.any?
142
- cursors['page_cursor'] = stack.dup
143
- break
144
- end
137
+ if break_after_page && yielded >= 100 && stack.any?
138
+ cursors['page_cursor'] = stack.dup
139
+ break
145
140
  end
146
141
  end
147
142
  end
@@ -261,30 +256,15 @@ module ConnectorsSdk
261
256
  request_endpoint(:endpoint => "drives/#{drive_id}/root", :query_params => query_params)
262
257
  end
263
258
 
264
- def item_children(drive_id, item_id, fields: [], break_after_page: false, &block)
265
- next_link = cursors.delete('item_children_next_link') if break_after_page
266
-
267
- response = if next_link.present?
268
- request_json(:url => next_link)
269
- else
270
- endpoint = "drives/#{drive_id}/items/#{item_id}/children"
271
- query_params = transform_fields_to_request_query_params(fields)
272
- request_endpoint(:endpoint => endpoint, :query_params => query_params)
273
- end
259
+ def item_children(drive_id, item_id, fields: [], &block)
260
+ endpoint = "drives/#{drive_id}/items/#{item_id}/children"
261
+ query_params = transform_fields_to_request_query_params(fields)
262
+ response = request_endpoint(:endpoint => endpoint, :query_params => query_params)
274
263
 
275
- yielded = 0
276
264
  loop do
277
265
  response.value.each(&block)
278
266
  next_link = response['@odata.nextLink']
279
-
280
267
  break if next_link.nil?
281
-
282
- yielded += response.value.size
283
- if break_after_page && yielded >= 100
284
- cursors['item_children_next_link'] = next_link
285
- break
286
- end
287
-
288
268
  response = request_json(:url => next_link)
289
269
  end
290
270
  end
@@ -51,12 +51,12 @@ module ConnectorsSdk
51
51
  capture_exception(e)
52
52
  end
53
53
 
54
- if break_after_page && (config.cursors['page_cursor'].present? || config.cursors['item_children_next_link'].present?)
54
+ if break_after_page && config.cursors['page_cursor'].present?
55
55
  break
56
56
  end
57
57
  end
58
58
 
59
- if break_after_page && config.cursors['page_cursor'].blank? && config.cursors['item_children_next_link'].blank?
59
+ if break_after_page && config.cursors['page_cursor'].blank?
60
60
  @completed = true
61
61
  config.overwrite_cursors!(retrieve_latest_cursors)
62
62
  log_debug("Completed #{modified_since.nil? ? 'full' : 'incremental'} extraction")
@@ -34,9 +34,9 @@ module ConnectorsSdk
34
34
  def document_batch(params)
35
35
  results = []
36
36
 
37
- extractor = extractor(params)
37
+ @extractor = extractor(params)
38
38
 
39
- extractor.yield_document_changes(:break_after_page => true, :modified_since => extractor.config.cursors['modified_since']) do |action, doc, download_args_and_proc|
39
+ @extractor.yield_document_changes(:break_after_page => true, :modified_since => @extractor.config.cursors['modified_since']) do |action, doc, download_args_and_proc|
40
40
  download_obj = nil
41
41
  if download_args_and_proc
42
42
  download_obj = {
@@ -54,11 +54,19 @@ module ConnectorsSdk
54
54
  }
55
55
  end
56
56
 
57
- [results, extractor.config.cursors, extractor.completed]
57
+ results
58
58
  rescue ConnectorsSdk::Office365::CustomClient::ClientError => e
59
59
  raise e.status_code == 401 ? ConnectorsShared::InvalidTokenError : e
60
60
  end
61
61
 
62
+ def cursors
63
+ @extractor.config.cursors
64
+ end
65
+
66
+ def completed?
67
+ @extractor.completed
68
+ end
69
+
62
70
  def deleted(params)
63
71
  results = []
64
72
  extractor(params).yield_deleted_ids(params[:ids]) do |id|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: connectors_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.3.0
4
+ version: 8.3.0.0.pre.20220414T060419Z
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -61,6 +61,9 @@ files:
61
61
  - LICENSE
62
62
  - NOTICE.txt
63
63
  - lib/connectors_sdk.rb
64
+ - lib/connectors_sdk/base/.config.rb.un~
65
+ - lib/connectors_sdk/base/.connectors.rb.un~
66
+ - lib/connectors_sdk/base/.registry.rb.un~
64
67
  - lib/connectors_sdk/base/adapter.rb
65
68
  - lib/connectors_sdk/base/config.rb
66
69
  - lib/connectors_sdk/base/custom_client.rb
@@ -70,6 +73,7 @@ files:
70
73
  - lib/connectors_sdk/office365/config.rb
71
74
  - lib/connectors_sdk/office365/custom_client.rb
72
75
  - lib/connectors_sdk/office365/extractor.rb
76
+ - lib/connectors_sdk/share_point/.http_call_wrapper.rb.un~
73
77
  - lib/connectors_sdk/share_point/adapter.rb
74
78
  - lib/connectors_sdk/share_point/authorization.rb
75
79
  - lib/connectors_sdk/share_point/extractor.rb
@@ -85,9 +89,9 @@ homepage: https://github.com/elastic/connectors
85
89
  licenses:
86
90
  - Elastic-2.0
87
91
  metadata:
88
- revision: e1223714e0bfdcdeb9a94774d6b81f5a8b5ce44e
89
- repository: git@github.com:elastic/ent-search-connectors.git
90
- post_install_message:
92
+ revision: 427fad57fc69a8107c127ecbf99c6a5e803ea90c
93
+ repository: https://github.com/elastic/connectors.git
94
+ post_install_message:
91
95
  rdoc_options: []
92
96
  require_paths:
93
97
  - lib
@@ -98,12 +102,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
102
  version: '0'
99
103
  required_rubygems_version: !ruby/object:Gem::Requirement
100
104
  requirements:
101
- - - ">="
105
+ - - ">"
102
106
  - !ruby/object:Gem::Version
103
- version: '0'
107
+ version: 1.3.1
104
108
  requirements: []
105
- rubygems_version: 3.0.3.1
106
- signing_key:
109
+ rubyforge_project:
110
+ rubygems_version: 2.7.7
111
+ signing_key:
107
112
  specification_version: 4
108
113
  summary: Gem containing apis used by Enterprise Search and implementations of Connectors
109
114
  test_files: []