aboutsummaryrefslogtreecommitdiff
path: root/src/dyndns_service/gandi.rs
diff options
context:
space:
mode:
authorGus Power <gus@infinitesidequests.com>2025-05-21 09:12:03 +0100
committerGus Power <gus@infinitesidequests.com>2025-05-21 09:12:03 +0100
commit9ce9c101a10327b1eb6902133173119c3e0f3732 (patch)
treeb9be802c8a9247551c6ed37f36184b4413c400fb /src/dyndns_service/gandi.rs
parent05157f8d5ba321a8886505a086db9f9f26d44ffe (diff)
clippy: PascalCase enums. rename serde field names.
Diffstat (limited to 'src/dyndns_service/gandi.rs')
-rw-r--r--src/dyndns_service/gandi.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dyndns_service/gandi.rs b/src/dyndns_service/gandi.rs
index 8851b2c..c8fe336 100644
--- a/src/dyndns_service/gandi.rs
+++ b/src/dyndns_service/gandi.rs
@@ -14,16 +14,17 @@ use serde_with::serde_as;
// See https://api.gandi.net/docs/livedns/ for more info
#[serde_as]
#[derive(Debug, Deserialize, PartialEq, Serialize)]
-pub struct Gandi {
+pub struct GandiConfig {
api_key: String,
- #[serde(default = "Gandi::default_method")]
+ #[serde(default = "GandiConfig::default_method")]
#[serde_as(as = "DisplayFromStr")]
method: Method,
- #[serde(default = "Gandi::default_record_type")]
+ #[serde(default = "GandiConfig::default_record_type")]
record_type: DnsRecordType,
}
-impl Gandi {
+impl GandiConfig {
+ #[cfg(test)]
pub fn new(api_key: String) -> Self {
Self {
api_key,
@@ -40,7 +41,7 @@ impl Gandi {
}
}
-impl DynDnsServiceConfiguration for Gandi {
+impl DynDnsServiceConfiguration for GandiConfig {
fn get_service_url(&self) -> String {
format!(
"https://api.gandi.net/api/v5/domains/{domain}/records/{subdomain}/{record_type}",
@@ -62,7 +63,7 @@ mod tests {
"api_key": "SOME-API-KEY",
});
- let gandi = serde_json::from_value::<Gandi>(input).unwrap();
+ let gandi = serde_json::from_value::<GandiConfig>(input).unwrap();
assert_eq!(gandi.record_type, DnsRecordType::A);
assert_eq!(gandi.method, Method::PUT);