Skip to content

Commit

Permalink
Added ingestion of Canada transit network
Browse files Browse the repository at this point in the history
The Via rail network was added to Amtrak's API. Therefore the schema
changed slightly. The object_id is only provided when the new provider
tag is marked "Amtrak".
  • Loading branch information
StefanBossbaly committed Jul 21, 2024
1 parent a253468 commit afb8195
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,17 @@ pub struct Train {
pub last_value: DateTime<FixedOffset>,

/// Unsure of what this field symbolizes.
///
/// Note: Only provided if provider is "Amtrak"
#[serde(rename = "objectID")]
pub object_id: u32,
pub object_id: Option<u32>,

/// The provider network of this information
///
/// # Examples:
/// * `Amtrak`
/// * `Via`
pub provider: String,
}

#[derive(Debug, Deserialize, Clone)]
Expand Down
3 changes: 2 additions & 1 deletion tests/train.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ async fn test_single_train() -> Result<(), amtrak_api::Error> {
"createdAt": "2023-08-29T23:39:50-04:00",
"updatedAt": "2023-08-29T23:39:50-04:00",
"lastValTS": "2023-08-29T23:39:34-04:00",
"objectID": 847
"objectID": 847,
"provider": "Amtrak"
}
]
}"#,
Expand Down

0 comments on commit afb8195

Please sign in to comment.