Skip to content

Commit

Permalink
Merge pull request #61 from DataDog/conor/get_all_screen
Browse files Browse the repository at this point in the history
Add get all API for screenboards.
  • Loading branch information
conorbranagan committed Jan 9, 2015
2 parents 4ba5a90 + 7f6b7de commit e9d19f3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/dogapi/facade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ def get_screenboard(board_id)
@screenboard_svc.get_screenboard(board_id)
end

def get_all_screenboards()
@screenboard_svc.get_all_screenboards()
end

def delete_screenboard(board_id)
@screenboard_svc.delete_screenboard(board_id)
end
Expand Down
14 changes: 13 additions & 1 deletion lib/dogapi/v1/screenboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ def get_screenboard(board_id)
end
end

def get_all_screenboards()
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}

request(Net::HTTP::Get, "/api/#{API_VERSION}/screen", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end

def delete_screenboard(board_id)
begin
params = {
Expand All @@ -65,7 +78,6 @@ def delete_screenboard(board_id)
end
end


def share_screenboard(board_id)
begin
params = {
Expand Down
3 changes: 3 additions & 0 deletions tests/test_screenboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ def test_screenboard
assert_equal status, "200", "invalid HTTP response => #{status}"
assert result["widgets"] == board["widgets"]

status, result = dog.get_all_screenboards()
assert_equal status, "200", "invalid HTTP response => #{status}"

status, result = dog.update_screenboard(result["id"], updated_board)
assert_equal status, "200", "invalid HTTP response => #{status}"
assert result["widgets"] == updated_board["widgets"]
Expand Down

0 comments on commit e9d19f3

Please sign in to comment.