Skip to content

Commit

Permalink
Change: support the active attribute in EmailForward
Browse files Browse the repository at this point in the history
  • Loading branch information
ggalmazor committed Nov 20, 2024
1 parent 445d12c commit 0748a3a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/dnsimple/struct/email_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class EmailForward < Base
# @return [String] The email recipient the messages are delivered to.
attr_accessor :destination_email

# @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

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("foo@a-domain.com")
expect(response.data[0].destination_email).to eq("jane.smith@example.com")
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("bar@a-domain.com")
expect(response.data[1].destination_email).to eq("john.doe@example.com")
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":"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}}
{"data":[{"id":24809,"domain_id":235146,"alias_email":"foo@a-domain.com","destination_email":"jane.smith@example.com","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":"bar@a-domain.com","destination_email":"john.doe@example.com","active":false,"created_at":"2017-05-25T19:23:16Z","updated_at":"2017-05-25T19:23:16Z","from":"bar@a-domain.com","to":"john.doe@example.com"}],"pagination":{"current_page":1,"per_page":30,"total_entries":1,"total_pages":1}}

0 comments on commit 0748a3a

Please sign in to comment.