Class: Hcp::Answer
- Inherits:
-
Object
- Object
- Hcp::Answer
- Defined in:
- lib/hcp/answer.rb
Overview
What Housecall Pro answered: the body it carries, or the refusal it stands for.
Constant Summary collapse
- RESET_HEADER =
The header Housecall Pro names the epoch a rate limit lifts at.
'RateLimit-Reset'
Instance Method Summary collapse
-
#body ⇒ Hash
The record or page Housecall Pro answered with.
-
#initialize(response) ⇒ Answer
constructor
A new instance of Answer.
Constructor Details
#initialize(response) ⇒ Answer
Returns a new instance of Answer.
8 9 10 |
# File 'lib/hcp/answer.rb', line 8 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Hash
Returns the record or page Housecall Pro answered with.
13 14 15 16 17 18 19 20 |
# File 'lib/hcp/answer.rb', line 13 def body case @response when Net::HTTPSuccess then parsed when Net::HTTPNotFound then raise NotFound, when Net::HTTPTooManyRequests then raise TooManyRequests.new(, reset_at) else raise Error, end end |