Class: MetaRPC::ResponseWrapper
- Inherits:
-
Object
- Object
- MetaRPC::ResponseWrapper
- Defined in:
- lib/metarpc/response_wrapper.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #enforce_correct_value ⇒ Object
-
#initialize(response) ⇒ ResponseWrapper
constructor
A new instance of ResponseWrapper.
- #value ⇒ Object
Constructor Details
#initialize(response) ⇒ ResponseWrapper
Returns a new instance of ResponseWrapper.
3 4 5 |
# File 'lib/metarpc/response_wrapper.rb', line 3 def initialize(response) @response = response end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/metarpc/response_wrapper.rb', line 16 def [](key) value[key] end |
#enforce_correct_value ⇒ Object
7 8 9 |
# File 'lib/metarpc/response_wrapper.rb', line 7 def enforce_correct_value raise RpcClientError.new(@response[:error]), "#{@response[:error][:code]} #{@response[:error][:message]}" if @response.key?(:error) end |
#value ⇒ Object
11 12 13 14 |
# File 'lib/metarpc/response_wrapper.rb', line 11 def value enforce_correct_value @response[:result] end |