diff --git a/Cargo.toml b/Cargo.toml index c74121bad..3a1f19efa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Kisio Digital ", "Guillaume Pinot "] name = "transit_model" -version = "0.31.5" +version = "0.32.0" license = "AGPL-3.0-only" description = "Transit data management" repository = "https://github.com/CanalTP/transit_model" diff --git a/gtfs2netexfr/Cargo.toml b/gtfs2netexfr/Cargo.toml index d5cd541ed..9334a68a6 100644 --- a/gtfs2netexfr/Cargo.toml +++ b/gtfs2netexfr/Cargo.toml @@ -22,4 +22,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../", features = ["proj"] } +transit_model = { version = "0.32", path = "../", features = ["proj"] } diff --git a/gtfs2ntfs/Cargo.toml b/gtfs2ntfs/Cargo.toml index 9637e6253..5767b9f84 100644 --- a/gtfs2ntfs/Cargo.toml +++ b/gtfs2ntfs/Cargo.toml @@ -22,4 +22,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../" } +transit_model = { version = "0.32", path = "../" } diff --git a/ntfs2gtfs/Cargo.toml b/ntfs2gtfs/Cargo.toml index 6db3143b7..47e77aa47 100644 --- a/ntfs2gtfs/Cargo.toml +++ b/ntfs2gtfs/Cargo.toml @@ -22,4 +22,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../" } +transit_model = { version = "0.32", path = "../" } diff --git a/ntfs2netexfr/Cargo.toml b/ntfs2netexfr/Cargo.toml index 48bf2254e..4d7471db2 100644 --- a/ntfs2netexfr/Cargo.toml +++ b/ntfs2netexfr/Cargo.toml @@ -22,4 +22,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../", features = ["proj"] } +transit_model = { version = "0.32", path = "../", features = ["proj"] } diff --git a/ntfs2ntfs/Cargo.toml b/ntfs2ntfs/Cargo.toml index 71a79b5d8..d75c16642 100644 --- a/ntfs2ntfs/Cargo.toml +++ b/ntfs2ntfs/Cargo.toml @@ -22,4 +22,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../" } +transit_model = { version = "0.32", path = "../" } diff --git a/restrict-validity-period/Cargo.toml b/restrict-validity-period/Cargo.toml index ab795928e..a555f9dc1 100644 --- a/restrict-validity-period/Cargo.toml +++ b/restrict-validity-period/Cargo.toml @@ -21,4 +21,4 @@ slog-scope = "4.1" slog-stdlog = "4.0" slog-term = "2.4" structopt = "0.3" -transit_model = { version = "0.31", path = "../" } +transit_model = { version = "0.32", path = "../" } diff --git a/src/gtfs/read.rs b/src/gtfs/read.rs index 27275bcd9..482dc5bae 100644 --- a/src/gtfs/read.rs +++ b/src/gtfs/read.rs @@ -79,6 +79,7 @@ impl From for objects::Company { url: Some(agency.url), mail: agency.email, phone: agency.phone, + codes: BTreeSet::new(), } } } diff --git a/src/lib.rs b/src/lib.rs index 2446ef114..219c07d0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,7 +58,7 @@ pub mod validity_period; pub mod vptranslator; /// Current version of the NTFS format -pub const NTFS_VERSION: &str = "0.11.2"; +pub const NTFS_VERSION: &str = "0.11.4"; /// The max distance in meters to compute the transfer pub const TRANSFER_MAX_DISTANCE: &str = "300"; diff --git a/src/ntfs/mod.rs b/src/ntfs/mod.rs index dfa709956..34f4ff966 100644 --- a/src/ntfs/mod.rs +++ b/src/ntfs/mod.rs @@ -394,7 +394,7 @@ mod tests { ("feed_end_date".to_string(), "20180131".to_string()), ("feed_publisher_name".to_string(), "Nicaragua".to_string()), ("feed_start_date".to_string(), "20180130".to_string()), - ("ntfs_version".to_string(), "0.11.2".to_string()), + ("ntfs_version".to_string(), "0.11.4".to_string()), ("tartare_platform".to_string(), "dev".to_string()), ], collections @@ -458,6 +458,7 @@ mod tests { url: Some("http://www.foo.fr/".to_string()), mail: Some("contact@foo.fr".to_string()), phone: Some("0123456789".to_string()), + codes: BTreeSet::new(), }, Company { id: "OIF:102".to_string(), @@ -466,6 +467,7 @@ mod tests { url: None, mail: None, phone: None, + codes: BTreeSet::new(), }, ]); } diff --git a/src/ntfs/write.rs b/src/ntfs/write.rs index 4486b25be..e91a1d918 100644 --- a/src/ntfs/write.rs +++ b/src/ntfs/write.rs @@ -770,6 +770,7 @@ pub fn write_codes(path: &path::Path, collections: &Collections) -> Result<()> { write_codes_from_collection_with_id(&mut wtr, &collections.lines, &path)?; write_codes_from_collection_with_id(&mut wtr, &collections.routes, &path)?; write_codes_from_collection_with_id(&mut wtr, &collections.vehicle_journeys, &path)?; + write_codes_from_collection_with_id(&mut wtr, &collections.companies, &path)?; wtr.flush() .with_context(|_| format!("Error reading {:?}", path))?; diff --git a/src/objects.rs b/src/objects.rs index 1594d2344..687ed3a15 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -43,6 +43,7 @@ pub enum ObjectType { StopTime, LineGroup, Ticket, + Company, } pub trait GetObjectType { @@ -61,6 +62,7 @@ impl ObjectType { ObjectType::StopTime => "stop_time", ObjectType::LineGroup => "line_group", ObjectType::Ticket => "ticket", + ObjectType::Company => "company", } } } @@ -1308,9 +1310,13 @@ pub struct Company { pub mail: Option, #[serde(rename = "company_phone")] pub phone: Option, + #[serde(skip)] + pub codes: KeysValues, } impl_id!(Company); +impl_codes!(Company); + impl Default for Company { fn default() -> Company { Company { @@ -1320,6 +1326,7 @@ impl Default for Company { url: None, mail: None, phone: None, + codes: BTreeSet::new(), } } } @@ -1328,6 +1335,11 @@ impl AddPrefix for Company { self.id = prefix_conf.referential_prefix(self.id.as_str()); } } +impl GetObjectType for Company { + fn get_object_type() -> ObjectType { + ObjectType::Company + } +} impl_with_id!(Company); diff --git a/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt b/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt index 7ad87e08a..42018b398 100644 --- a/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt @@ -7,6 +7,6 @@ feed_license,DefaultDatasourceLicense feed_license_url,http://www.default-datasource-website.com feed_publisher_name,DefaultContributorName feed_start_date,20180101 -ntfs_version,0.11.2 +ntfs_version,0.11.4 tartare_contributor_id,DefaultContributorId tartare_platform,dev diff --git a/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt b/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt index cd9e2e21a..67138039d 100644 --- a/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180106 feed_start_date,20180101 -ntfs_version,0.11.2 +ntfs_version,0.11.4 diff --git a/tests/fixtures/restrict-validity-period/output/feed_infos.txt b/tests/fixtures/restrict-validity-period/output/feed_infos.txt index d565ddf3b..a4cae1d06 100644 --- a/tests/fixtures/restrict-validity-period/output/feed_infos.txt +++ b/tests/fixtures/restrict-validity-period/output/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180805 feed_start_date,20180501 -ntfs_version,0.11.2 +ntfs_version,0.11.4