Class: Factual::Response
- Inherits:
-
Object
- Object
- Factual::Response
- Defined in:
- lib/factual.rb
Instance Method Summary collapse
- #[](*keys) ⇒ Object
-
#initialize(obj) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(obj) ⇒ Response
Returns a new instance of Response.
345 346 347 |
# File 'lib/factual.rb', line 345 def initialize(obj) @obj = obj end |
Instance Method Details
#[](*keys) ⇒ Object
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
# File 'lib/factual.rb', line 349 def [](*keys) begin ret = @obj keys.each do |key| ret = ret[key] end if ret.is_a?(Hash) return Response.new(ret) else return ret end rescue Exception => e Factual::ResponseError.new("Unexpected API response") end end |