patchwork_csv_utils 0.1.20-aarch64-linux → 0.1.21-aarch64-linux

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: 4490cec46fe8db3039acdf1fb6804a29335d5f634ef3704f50ff256ae382d209
4
- data.tar.gz: 3d69cd3a3f483270e2ab0531eb8adb216fbfd7ed6039ae009ab454a80e42cf5e
3
+ metadata.gz: aca603756d24698f85aee053ff0d3684216d2b209c246ae46d695864f9b69229
4
+ data.tar.gz: 3077975203564e253de4ec9968611d58f3d486e9a16100ebe2df913fc1d5fe26
5
5
  SHA512:
6
- metadata.gz: 8d8a798be3930f41ddb4cf356cca2e1c7924c7c4e367c0fbb5089f276d4ce7cc3a525fa6d38ecf32ed53e8690c76408fed7b7c8f44cdce83c9a4818802f63ad7
7
- data.tar.gz: dbd6d528035955f3959c8ccfef0548c874f06a4513cf0333c181581164895ca84d99d0d78159187997be82fc4b2f76c0716eb7daba56a387ef8f7b155387d84f
6
+ metadata.gz: 177c8082986e0e48ab4852f11fd082475117cd0aef6c13fbf44951ca9f6712202b641224a070f339fb288c0c264aec5d0a9a9df711c1e8e3bdc0905dc751b53b
7
+ data.tar.gz: f6132a683eede976ae4788bb9126322e2de9b262d9c1ef4ac6d63b9a402a66e98d72dbe4f2269e3c40650519145903791cf4929c642a3d0e8c38f008644adbed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- patchwork_csv_utils (0.1.20)
4
+ patchwork_csv_utils (0.1.21)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -9,7 +9,7 @@ pub mod utils;
9
9
  fn init() -> Result<(), magnus::Error> {
10
10
  let module = define_module("CsvUtils")?;
11
11
  module.define_singleton_method("dedup", function!(dedup, 4))?;
12
- module.define_singleton_method("to_csv", function!(to_csv, 6))?;
13
- module.define_singleton_method("transform_csv", function!(transform_csv, 6))?;
12
+ module.define_singleton_method("to_csv", function!(to_csv, 7))?;
13
+ module.define_singleton_method("transform_csv", function!(transform_csv, 7))?;
14
14
  Ok(())
15
15
  }
@@ -10,7 +10,8 @@ pub fn transform_csv(ruby: &Ruby, csv_path: String,
10
10
  target_path: String, exclusions: RArray,
11
11
  mandatory_headers: RArray,
12
12
  status_exclusions: RArray,
13
- expected_trust_name: String,) -> magnus::error::Result<()> {
13
+ expected_trust_name: String,
14
+ is_streamed_file: bool) -> magnus::error::Result<()> {
14
15
  if !csv_path.has_extension(&["csv"]) {
15
16
  return Err(Error::new(ruby.exception_standard_error(), "csv_path must be a csv file".to_string()));
16
17
  }
@@ -60,7 +61,9 @@ pub fn transform_csv(ruby: &Ruby, csv_path: String,
60
61
  let column_value = record.get(*column_index).ok_or(missing_value(ruby, column))?;
61
62
  let column_value = column_value.trim_end();
62
63
 
63
- validate_trust_name(ruby, &expected_trust_name, trust_name, i, &column_value.to_string())?;
64
+ if !is_streamed_file {
65
+ validate_trust_name(ruby, &expected_trust_name, trust_name, i, &column_value.to_string())?;
66
+ }
64
67
 
65
68
  if i == *date {
66
69
  let current = string_to_datetime(column_value).ok_or(to_datetime_error(ruby, column_value, ri, "Date"))?;
@@ -14,6 +14,7 @@ pub fn to_csv(ruby: &Ruby, xls_path: String,
14
14
  mandatory_headers: RArray,
15
15
  status_exclusions: RArray,
16
16
  expected_trust_name: String,
17
+ is_streamed_file: bool
17
18
  ) -> magnus::error::Result<()> {
18
19
  if !xls_path.has_extension(&["xls","xlsx"]) {
19
20
  return Err(magnus::Error::new(ruby.exception_standard_error(), "xls_path must be an xls or xlsx file".to_string()));
@@ -40,7 +41,7 @@ pub fn to_csv(ruby: &Ruby, xls_path: String,
40
41
  let csv_out_file = File::create(target_path.clone()).map_err(|e| magnus_err(ruby, e, format!("could not create csv file: {}", target_path).as_str()))?;
41
42
  let mut dest = BufWriter::new(csv_out_file);
42
43
 
43
- write_csv(ruby, &mut dest, &range, header_map, exclusions, mandatory_headers, headers_list, status_exclusions, expected_trust_name)
44
+ write_csv(ruby, &mut dest, &range, header_map, exclusions, mandatory_headers, headers_list, status_exclusions, expected_trust_name, is_streamed_file)
44
45
  }
45
46
 
46
47
  fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
@@ -48,7 +49,8 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
48
49
  mandatory_headers: Vec<String>,
49
50
  headers_list: Vec<String>,
50
51
  status_exclusions: Vec<String>,
51
- expected_trust_name: String) -> magnus::error::Result<()> {
52
+ expected_trust_name: String,
53
+ is_streamed_file: bool) -> magnus::error::Result<()> {
52
54
  let n = mandatory_headers.len() - 1;
53
55
  let request_id = header_map.get("Request Id").ok_or(missing_header(ruby, "Request Id"))?;
54
56
  let date = header_map.get("Date").ok_or(missing_header(ruby, "Date"))?;
@@ -71,7 +73,10 @@ fn write_csv<W: Write>(ruby: &Ruby, dest: &mut W, range: &Range<Data>,
71
73
  if date_value_is_not_present(&date, &r) {
72
74
  return Err(magnus::Error::new(ruby.exception_standard_error(), format!("Date value is not present in row: {}", ri)));
73
75
  }
74
- validate_trust_name(ruby, &expected_trust_name, trust_name, ri, &r)?;
76
+
77
+ if !is_streamed_file {
78
+ validate_trust_name(ruby, &expected_trust_name, trust_name, ri, &r)?;
79
+ }
75
80
 
76
81
  for (i, c) in mandatory_headers.iter().enumerate() {
77
82
  let column_index = header_map.get(c).ok_or(missing_header(ruby, c))?;
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CsvUtils
4
- VERSION = '0.1.20'
4
+ VERSION = '0.1.21'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patchwork_csv_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.21
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - kingsley.hendrickse
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Deduplication of CSV files and XLS to CSV conversion.
14
14
  email: