class Trustly::Data::JSONRPCResponse
Public Class Methods
new(http_response)
click to toggle source
Calls superclass method
Trustly::Data::Response::new
# File lib/trustly/data/jsonrpc_response.rb, line 3 def initialize(http_response) super(http_response) version = self.get("version") raise Trustly::Exception::JSONRPCVersionError, "JSON RPC Version is not supported" if version != '1.1' end
Public Instance Methods
get_data(name=nil)
click to toggle source
# File lib/trustly/data/jsonrpc_response.rb, line 9 def get_data(name=nil) return self.response_result.try(:[],"data") if name.nil? return Trustly::Exception::DataError, "Data not found or key is null" if self.response_result.try(:[],"data").nil? || name.nil? return self.response_result["data"][name] end