aboutsummaryrefslogtreecommitdiff
path: root/src/dyndns_service/gandi.rs
diff options
context:
space:
mode:
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);