ox-tender-abstract 0.9.3 → 0.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9924cb49a0b35703d8e0093b3ae40b8b8556f7da398990b3ff5f84f185c7d944
4
- data.tar.gz: 2598c2bb4af463aa3cbf1bde9c1cc76aac352f8e58a193152305dccc4a2cef8a
3
+ metadata.gz: cf4b74ab15f633cbfb3ad65d37a5fa900016e45e01f1bb300284b28609d805d7
4
+ data.tar.gz: 53564ab6b3af3c30998b241ee69a899875394833bdce28f2e2ad765edd81dfca
5
5
  SHA512:
6
- metadata.gz: 3c0a783ab40ca1f45be2d0d5c32db63345a40502bdf6140b446018686b73482afba84ce3097d7ab7afe821b106915e06ba32b03b66a35a19adf95fdc4ad2c404
7
- data.tar.gz: 53a15a50dad376969b8ff1869e88197a669288bdd57b3931ce59105c8288b25f6f9a9768e03b9211f8284570e4bbf219daa98f2702270c39c967c5e1737c4ead
6
+ metadata.gz: d122d953f825672d6b61d551f49c08a669eaeb4ef60b55d4c718c4d9dd9ee68e99d83a026745ff77451963ed30957a0ef684bcb67300574dab9f7e18e64e22c7
7
+ data.tar.gz: 7396189e5e44a5c3fa5b9e988b6ed0394072b1b7fadacfed60df6ebe36afd741685efa3f46978912028c561f4c0aa5820a85560bf5222134fab840815a88c25a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.9.4] - 2025-07-28
2
+
3
+ - include_attachments
4
+
1
5
  ## [0.9.3] - 2025-07-27
2
6
 
3
7
  - Added support for parsing tender documents
@@ -29,18 +29,19 @@ module OxTenderAbstract
29
29
 
30
30
  # Convenience method for searching tenders in specific subsystem
31
31
  def search_tenders(org_region:, exact_date:, subsystem_type: DocumentTypes::DEFAULT_SUBSYSTEM,
32
- document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE)
32
+ document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE, include_attachments: true)
33
33
  client = Client.new
34
34
  client.search_tenders(
35
35
  org_region: org_region,
36
36
  exact_date: exact_date,
37
37
  subsystem_type: subsystem_type,
38
- document_type: document_type
38
+ document_type: document_type,
39
+ include_attachments: include_attachments
39
40
  )
40
41
  end
41
42
 
42
43
  # Enhanced method for searching tenders across multiple subsystems
43
- def search_all_tenders(org_region:, exact_date:, subsystems: nil, document_types: nil)
44
+ def search_all_tenders(org_region:, exact_date:, subsystems: nil, document_types: nil, include_attachments: true)
44
45
  # Default subsystems to search
45
46
  subsystems ||= %w[PRIZ RPEC RPGZ BTK UR RGK OD223 RD223]
46
47
 
@@ -67,7 +68,8 @@ module OxTenderAbstract
67
68
  org_region: org_region,
68
69
  exact_date: exact_date,
69
70
  subsystem_type: subsystem_type,
70
- document_type: doc_type
71
+ document_type: doc_type,
72
+ include_attachments: include_attachments
71
73
  )
72
74
 
73
75
  if result.success?
@@ -134,7 +136,8 @@ module OxTenderAbstract
134
136
 
135
137
  # Search tenders with automatic wait on API blocks and resume capability
136
138
  def search_tenders_with_auto_wait(org_region:, exact_date:, subsystem_type: DocumentTypes::DEFAULT_SUBSYSTEM,
137
- document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE, resume_state: nil)
139
+ document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE, resume_state: nil,
140
+ include_attachments: true)
138
141
  client = Client.new
139
142
 
140
143
  # Если есть состояние для продолжения
@@ -146,7 +149,8 @@ module OxTenderAbstract
146
149
  subsystem_type: subsystem_type,
147
150
  document_type: document_type,
148
151
  start_from_archive: start_from,
149
- resume_state: resume_state
152
+ resume_state: resume_state,
153
+ include_attachments: include_attachments
150
154
  )
151
155
  else
152
156
  # Используем обычный метод если авто-ожидание включено
@@ -155,7 +159,8 @@ module OxTenderAbstract
155
159
  org_region: org_region,
156
160
  exact_date: exact_date,
157
161
  subsystem_type: subsystem_type,
158
- document_type: document_type
162
+ document_type: document_type,
163
+ include_attachments: include_attachments
159
164
  )
160
165
  else
161
166
  # Используем метод с возможностью продолжения
@@ -163,7 +168,8 @@ module OxTenderAbstract
163
168
  org_region: org_region,
164
169
  exact_date: exact_date,
165
170
  subsystem_type: subsystem_type,
166
- document_type: document_type
171
+ document_type: document_type,
172
+ include_attachments: include_attachments
167
173
  )
168
174
  end
169
175
  end
@@ -76,7 +76,7 @@ module OxTenderAbstract
76
76
 
77
77
  # Search tenders with full workflow: API -> Archive -> Parse
78
78
  def search_tenders(org_region:, exact_date:, subsystem_type: DocumentTypes::DEFAULT_SUBSYSTEM,
79
- document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE)
79
+ document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE, include_attachments: true)
80
80
  log_info "Starting tender search for region #{org_region}, date #{exact_date}, subsystem: #{subsystem_type}, type: #{document_type}"
81
81
 
82
82
  # Step 1: Get archive URLs from API
@@ -133,6 +133,15 @@ module OxTenderAbstract
133
133
  tender_data = parse_result.data[:content]
134
134
  next if tender_data[:reestr_number].nil? || tender_data[:reestr_number].empty?
135
135
 
136
+ # Extract attachments if requested
137
+ if include_attachments
138
+ attachments_result = extract_attachments_from_xml(file_data[:content])
139
+ if attachments_result.success?
140
+ tender_data[:attachments] = attachments_result.data[:attachments]
141
+ tender_data[:attachments_count] = attachments_result.data[:total_count]
142
+ end
143
+ end
144
+
136
145
  # Add metadata
137
146
  tender_data[:source_file] = file_name
138
147
  tender_data[:archive_url] = archive_url
@@ -240,7 +249,7 @@ module OxTenderAbstract
240
249
  # Позволяет продолжить загрузку с места паузы при блокировках API
241
250
  def search_tenders_with_resume(org_region:, exact_date:, subsystem_type: DocumentTypes::DEFAULT_SUBSYSTEM,
242
251
  document_type: DocumentTypes::DEFAULT_DOCUMENT_TYPE,
243
- start_from_archive: 0, resume_state: nil)
252
+ start_from_archive: 0, resume_state: nil, include_attachments: true)
244
253
  log_info "Starting tender search with resume capability for region #{org_region}, date #{exact_date}"
245
254
  log_info "Starting from archive #{start_from_archive}" if start_from_archive > 0
246
255
 
@@ -330,6 +339,15 @@ module OxTenderAbstract
330
339
  tender_data = parse_result.data[:content]
331
340
  next if tender_data[:reestr_number].nil? || tender_data[:reestr_number].empty?
332
341
 
342
+ # Extract attachments if requested
343
+ if include_attachments
344
+ attachments_result = extract_attachments_from_xml(file_data[:content])
345
+ if attachments_result.success?
346
+ tender_data[:attachments] = attachments_result.data[:attachments]
347
+ tender_data[:attachments_count] = attachments_result.data[:total_count]
348
+ end
349
+ end
350
+
333
351
  # Add metadata
334
352
  tender_data[:source_file] = file_name
335
353
  tender_data[:archive_url] = archive_url
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OxTenderAbstract
4
- VERSION = '0.9.3'
4
+ VERSION = '0.9.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox-tender-abstract
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - smolev