Skip to content

Commit

Permalink
change functions slightly for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
ali-graham committed Sep 6, 2012
1 parent 0fe7ac2 commit a81a27a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -24,7 +24,7 @@ Set the URI of the Flapjack server:
Flapjack::Diner.base_uri('127.0.0.1:5000')
```

Return a list of monitored entities, and their statuses:
Return a list of monitored entities, and their statuses for all associated checks:

```ruby
Flapjack::Diner.entities
Expand All @@ -36,16 +36,16 @@ Return a list of checks for an entity:
Flapjack::Diner.checks('example.com')
```

Return a list of check statuses for an entity
Return the statuses for all checks on an entity

```ruby
Flapjack::Diner.status('example.com')
```

Return a single check status for an entity
Return the status for a check on an entity

```ruby
Flapjack::Diner.check_status('example.com', 'ping')
Flapjack::Diner.status('example.com', 'ping')
```

Return lists of scheduled maintenance periods for all checks on an entity:
Expand Down
13 changes: 5 additions & 8 deletions lib/flapjack-diner.rb
Expand Up @@ -25,17 +25,14 @@ def checks(entity)
jsonify( get("/checks/#{entity_esc}") )
end

def status(entity)
def status(entity, check = nil)
entity_esc = prepare(entity, :required => 'entity')
check_esc = prepare(check)

jsonify( get("/status/#{entity_esc}") )
end

def check_status(entity, check)
entity_esc = prepare(entity, :required => 'entity')
check_esc = prepare(check, :required => 'check')
s_url = "/status/#{entity_esc}"
s_url += "/#{check_esc}" if check_esc

jsonify( get("/status/#{entity_esc}/#{check_esc}") )
jsonify( get(s_url) )
end

def acknowledge!(entity, check, options = {})
Expand Down
2 changes: 1 addition & 1 deletion spec/flapjack-diner_spec.rb
Expand Up @@ -56,7 +56,7 @@
:body => response_body)
JSON.should_receive(:parse).with(response_body).and_return(api_result)

result = Flapjack::Diner.check_status(entity, check)
result = Flapjack::Diner.status(entity, check)
req.should have_been_requested
result.should_not be_nil
result.should == api_result
Expand Down

0 comments on commit a81a27a

Please sign in to comment.