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 get all API for screenboards. #61

Merged
merged 1 commit into from
Jan 9, 2015
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
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