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

Update EmailForward fields #254

Merged
merged 5 commits into from
May 27, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## main

- NEW: Added `alias_email` and `destination_email` to `Dnsimple.EmailForward`

## 4.0.0

- CHANGED: Requires Elixir >= 2.12 and OTP >= 22
Expand Down
4 changes: 3 additions & 1 deletion lib/dnsimple/email_forward.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ defmodule Dnsimple.EmailForward do
domain_id: integer,
from: String.t,
to: String.t,
alias_email: String.t,
destination_email: String.t,
created_at: String.t,
updated_at: String.t,
}

defstruct ~w(id domain_id from to created_at updated_at)a
defstruct ~w(id domain_id from to alias_email destination_email created_at updated_at)a

end
4 changes: 3 additions & 1 deletion test/dnsimple/domains_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ defmodule Dnsimple.DomainsTest do

data = response.data
assert is_list(data)
assert length(data) == 2
assert length(data) == 1
assert Enum.all?(data, fn(single) -> single.__struct__ == Dnsimple.EmailForward end)
end
end
Expand Down Expand Up @@ -343,6 +343,8 @@ defmodule Dnsimple.DomainsTest do
assert data.domain_id == 235146
assert data.from == "example@dnsimple.xyz"
assert data.to == "example@example.com"
assert data.alias_email == "example@dnsimple.xyz"
assert data.destination_email == "example@example.com"
assert data.created_at == "2021-01-25T13:54:40Z"
assert data.updated_at == "2021-01-25T13:54:40Z"
end
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures.http/createEmailForward/created.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ HTTP/1.1 201 Created
Server: nginx
Date: Mon, 25 Jan 2021 13:54:40 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 4800
X-RateLimit-Remaining: 4772
Expand All @@ -18,4 +19,4 @@ X-Permitted-Cross-Domain-Policies: none
Content-Security-Policy: frame-ancestors 'none'
Strict-Transport-Security: max-age=31536000

{"data":{"id":41872,"domain_id":235146,"alias_email":"example@dnsimple.xyz","destination_email":"example@example.com","created_at":"2021-01-25T13:54:40Z","updated_at":"2021-01-25T13:54:40Z","from":"example@dnsimple.xyz","to":"example@example.com"}}
{"data":{"id":41872,"domain_id":235146,"alias_email":"example@dnsimple.xyz","destination_email":"example@example.com","created_at":"2021-01-25T13:54:40Z","updated_at":"2021-01-25T13:54:40Z","from":"example@dnsimple.xyz","to":"example@example.com"}}
3 changes: 2 additions & 1 deletion test/fixtures.http/getEmailForward/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ HTTP/1.1 200 OK
Server: nginx
Date: Mon, 25 Jan 2021 13:56:24 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: identity
Connection: keep-alive
X-RateLimit-Limit: 4800
X-RateLimit-Remaining: 4766
Expand All @@ -18,4 +19,4 @@ X-Permitted-Cross-Domain-Policies: none
Content-Security-Policy: frame-ancestors 'none'
Strict-Transport-Security: max-age=31536000

{"data":{"id":41872,"domain_id":235146,"alias_email":"example@dnsimple.xyz","destination_email":"example@example.com","created_at":"2021-01-25T13:54:40Z","updated_at":"2021-01-25T13:54:40Z","from":"example@dnsimple.xyz","to":"example@example.com"}}
{"data":{"id":41872,"domain_id":235146,"alias_email":"example@dnsimple.xyz","destination_email":"example@example.com","created_at":"2021-01-25T13:54:40Z","updated_at":"2021-01-25T13:54:40Z","from":"example@dnsimple.xyz","to":"example@example.com"}}
20 changes: 10 additions & 10 deletions test/fixtures.http/listEmailForwards/success.http

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add an extra line at the end here 😅

Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 04 Feb 2016 14:07:19 GMT
Date: Fri, 17 May 2024 09:07:28 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 4000
X-RateLimit-Remaining: 3993
X-RateLimit-Reset: 1454596043
ETag: W/"3f10aae0cf0f0b81bdb4f58786ee1750"
X-RateLimit-Limit: 4800
X-RateLimit-Remaining: 4748
X-RateLimit-Reset: 1715936948
X-WORK-WITH-US: Love automation? So do we! https://dnsimple.com/jobs
ETag: W/"a5eed9a071f03e10fc67001ccc647a94"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: 6e3aa9d0-cb95-4186-93b0-630da372de86
X-Runtime: 0.026287
Strict-Transport-Security: max-age=31536000
X-Request-Id: e42df983-a8a5-4123-8c74-fb89ab934aba
X-Runtime: 0.025456
Strict-Transport-Security: max-age=63072000

{"data":[{"id":17702,"domain_id":228963,"from":".*@a-domain.com","to":"jane.smith@example.com","created_at":"2016-02-04T13:59:29Z","updated_at":"2016-02-04T13:59:29Z"},{"id":17703,"domain_id":228963,"from":"john@a-domain.com","to":"john@example.com","created_at":"2016-02-04T14:07:13Z","updated_at":"2016-02-04T14:07:13Z"}],"pagination":{"current_page":1,"per_page":30,"total_entries":2,"total_pages":1}}
{"data":[{"id":24809,"domain_id":235146,"alias_email":".*@a-domain.com","destination_email":"jane.smith@example.com","created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":".*@a-domain.com","to":"jane.smith@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
Loading