Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing attributes to the Zone API responses #47

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).

## main

ENHANCEMENTS:

- NEW: Added `Secondary`, `LastTransferredAt`, `Active` to `Zone` (dnsimple/dnsimple-rust)

## 0.5.0

FEATURES:
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ thiserror = "1.0"

[dev-dependencies]
assert_matches = "1.5"
mockito = "1.0"
mockito = "= 1.1.0"
colored = "= 2.0.0"
7 changes: 7 additions & 0 deletions src/dnsimple/zones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ pub struct Zone {
pub name: String,
/// True if the zone is a reverse zone.
pub reverse: bool,
/// True if the zone is a secondary zone.
pub secondary: bool,
/// Last time the zone was transferred.
#[serde(skip_serializing_if = "Option::is_none")]
pub last_transferred_at: Option<String>,
/// True if the zone is active.
pub active: bool,
/// When the zone was created in DNSimple.
pub created_at: String,
/// When the zone was created in DNSimple.
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/getZone/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: 93182033-a215-484e-a107-5235fa48001c
X-Runtime: 0.177942
Strict-Transport-Security: max-age=31536000

{"data":{"id":1,"account_id":1010,"name":"example-alpha.com","reverse":false,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"}}
{"data":{"id":1,"account_id":1010,"name":"example-alpha.com","reverse":false,"secondary":false,"last_transferred_at":null,"active":true,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/listZones/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: 01be9fa5-3a00-4d51-a927-f17587cb67ec
X-Runtime: 0.037083
Strict-Transport-Security: max-age=31536000

{"data":[{"id":1,"account_id":1010,"name":"example-alpha.com","reverse":false,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"},{"id":2,"account_id":1010,"name":"example-beta.com","reverse":true,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
{"data":[{"id":1,"account_id":1010,"name":"example-alpha.com","reverse":false,"secondary":false,"last_transferred_at":null,"active":true,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"},{"id":2,"account_id":1010,"name":"example-beta.com","reverse":false,"secondary":false,"last_transferred_at":null,"active":true,"created_at":"2015-04-23T07:40:03Z","updated_at":"2015-04-23T07:40:03Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
6 changes: 6 additions & 0 deletions tests/zones_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ fn list_zones_test() {
assert_eq!(1010, zone.account_id);
assert_eq!("example-alpha.com", zone.name);
assert!(!zone.reverse);
assert!(!zone.secondary);
assert!(zone.last_transferred_at.is_none());
assert!(zone.active);
assert_eq!("2015-04-23T07:40:03Z", zone.created_at);
assert_eq!("2015-04-23T07:40:03Z", zone.updated_at);
}
Expand All @@ -96,6 +99,9 @@ fn get_zone_test() {
assert_eq!(1010, zone.account_id);
assert_eq!("example-alpha.com", zone.name);
assert!(!zone.reverse);
assert!(!zone.secondary);
assert!(zone.last_transferred_at.is_none());
assert!(zone.active);
assert_eq!("2015-04-23T07:40:03Z", zone.created_at);
assert_eq!("2015-04-23T07:40:03Z", zone.updated_at);
}
Expand Down
Loading