Sha256: 7dba8e6204aae6c151b778bd9821bc39ba5710af53f4de54bf82549a23fb4339

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

#
# Counterblock APIs
#
module Katapaty
  class Block
    class << self

      def request(method_name, payload={})
        client = RestClient::Resource.new Katapaty.configuration.counterblock_url
        request = { method: method_name, params: payload, jsonrpc: '2.0', id: '0' }.to_json
        response = JSON.parse client.post(request,
                      accept: 'json',
                      content_type: 'json' )
        raise JsonResponseError.new response if response.has_key? 'code'
        raise ResponseError.new response['error'] if response.has_key? 'error'
        response['result']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katapaty-0.4.0 lib/katapaty/block.rb