Class: Rexpense::Response
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Rexpense::Response
- Defined in:
- lib/rexpense/response.rb
Instance Method Summary collapse
Instance Method Details
#parsed_body(key = nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/rexpense/response.rb', line 18 def parsed_body(key = nil) return JSON.parse(body)[key] unless key.nil? JSON.parse(body) rescue JSON::ParserError {} end |
#resolve! ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/rexpense/response.rb', line 8 def resolve! if success? block_given? ? yield(self) : self elsif timed_out? raise RequestTimeout else error! end end |