Skip to content

Commit

Permalink
Change: update code and fixtures to reflect a change in the payload s…
Browse files Browse the repository at this point in the history
…chema
  • Loading branch information
ggalmazor committed Jan 26, 2024
1 parent 7f452d9 commit 68016ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/dnsimple/struct/dns_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DnsAnalytics < Base
attr_accessor :date

# @return [String] The zone name
attr_accessor :zone
attr_accessor :zone_name

end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/dnsimple/client/dns_analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
end

it "supports groupings" do
subject.query(1, groupings: 'date,zone')
subject.query(1, groupings: 'date,zone_name')

expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/1/dns_analytics?groupings=date,zone")
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/1/dns_analytics?groupings=date,zone_name")
end


Expand All @@ -53,7 +53,7 @@

expect(response.data.all?(Dnsimple::Struct::DnsAnalytics)).to be(true)
expect(response.data[0].date).to eq('2023-12-08')
expect(response.data[0].zone).to eq('bar.com')
expect(response.data[0].zone_name).to eq('bar.com')
expect(response.data[0].volume).to eq(1200)
end

Expand All @@ -75,8 +75,8 @@
expect(query["account_id"]).to eq(1)
expect(query["start_date"]).to eq('2023-12-08')
expect(query["end_date"]).to eq('2024-01-08')
expect(query["sort"]).to eq("zone:asc,date:asc")
expect(query["groupings"]).to eq("zone,date")
expect(query["sort"]).to eq("zone_name:asc,date:asc")
expect(query["groupings"]).to eq("zone_name,date")
expect(query["page"]).to eq(0)
expect(query["per_page"]).to eq(100)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures.http/dnsAnalytics/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

{"data": {"headers": ["zone", "date", "volume"], "rows": [["bar.com", "2023-12-08", 1200], ["bar.com", "2023-12-09", 1200], ["bar.com", "2024-01-07", 1200], ["bar.com", "2024-01-08", 1200], ["example.com", "2023-12-08", 1200], ["example.com", "2023-12-09", 1200], ["example.com", "2024-01-07", 1200], ["example.com", "2024-01-08", 1200], ["foo.com", "2023-12-08", 1200], ["foo.com", "2023-12-09", 1200], ["foo.com", "2024-01-07", 1200], ["foo.com", "2024-01-08", 1200]]}, "query": {"account_id": 1, "start_date": "2023-12-08", "end_date": "2024-01-08", "sort": "zone:asc,date:asc", "page": 0, "per_page": 100, "groupings": "zone,date"}, "pagination": {"current_page": 0, "per_page": 100, "total_entries": 93, "total_pages": 1}}
{"data": {"headers": ["zone_name", "date", "volume"], "rows": [["bar.com", "2023-12-08", 1200], ["bar.com", "2023-12-09", 1200], ["bar.com", "2024-01-07", 1200], ["bar.com", "2024-01-08", 1200], ["example.com", "2023-12-08", 1200], ["example.com", "2023-12-09", 1200], ["example.com", "2024-01-07", 1200], ["example.com", "2024-01-08", 1200], ["foo.com", "2023-12-08", 1200], ["foo.com", "2023-12-09", 1200], ["foo.com", "2024-01-07", 1200], ["foo.com", "2024-01-08", 1200]]}, "query": {"account_id": 1, "start_date": "2023-12-08", "end_date": "2024-01-08", "sort": "zone_name:asc,date:asc", "page": 0, "per_page": 100, "groupings": "zone_name,date"}, "pagination": {"current_page": 0, "per_page": 100, "total_entries": 93, "total_pages": 1}}

0 comments on commit 68016ce

Please sign in to comment.