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 active attribute in EmailForward struct #400

Merged
merged 2 commits into from
Nov 22, 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
5 changes: 4 additions & 1 deletion lib/dnsimple/struct/email_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ class EmailForward < Base

# @return [String] The email recipient the messages are delivered to.
attr_accessor :destination_email
# @return [String] Then the email forward was last updated in DNSimple.

# @return [Boolean] True if the email forward is active, false otherwise.
attr_accessor :active

# @return [String] When the email forward was created in DNSimple.
attr_accessor :created_at

# @return [String] When the email forward was last updated in DNSimple.
attr_accessor :updated_at

end
Expand Down
18 changes: 12 additions & 6 deletions spec/dnsimple/client/domains_email_forwards_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,18 @@

expect(response).to be_a(Dnsimple::PaginatedResponse)
expect(response.data).to be_a(Array)
expect(response.data.size).to eq(1)

response.data.each do |result|
expect(result).to be_a(Dnsimple::Struct::EmailForward)
expect(result.id).to be_a(Integer)
end
expect(response.data.size).to eq(2)

expect(response.data[0].id).to eq(24809)
expect(response.data[0].domain_id).to eq(235146)
expect(response.data[0].alias_email).to eq("[email protected]")
expect(response.data[0].destination_email).to eq("[email protected]")
expect(response.data[0].active).to be(true)
expect(response.data[1].id).to eq(24810)
expect(response.data[1].domain_id).to eq(235146)
expect(response.data[1].alias_email).to eq("[email protected]")
expect(response.data[1].destination_email).to eq("[email protected]")
expect(response.data[1].active).to be(false)
end

it "exposes the pagination information" do
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures.http/listEmailForwards/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ X-Request-Id: e42df983-a8a5-4123-8c74-fb89ab934aba
X-Runtime: 0.025456
Strict-Transport-Security: max-age=63072000

{"data":[{"id":24809,"domain_id":235146,"alias_email":".*@a-domain.com","destination_email":"[email protected]","created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":".*@a-domain.com","to":"[email protected]"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}
{"data":[{"id":24809,"domain_id":235146,"alias_email":"foo@a-domain.com","destination_email":"[email protected]","active":true,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"foo@a-domain.com","to":"jane.smith@example.com"},{"id":24810,"domain_id":235146,"alias_email":"[email protected]","destination_email":"[email protected]","active":false,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"[email protected]","to":"john.doe@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}