Sha256: c956c190a12dc4f9770db699c6644ccc108c6632016ea47fd02c84942f707eaf
Contents?: true
Size: 909 Bytes
Versions: 4
Compression:
Stored size: 909 Bytes
Contents
# frozen_string_literal: true require 'attr_extras' require 'ostruct' module RavencoinRpc # This is base class class Client pattr_initialize %i[url! login! password!] def call(method, args = []) send_method!.call(method, args) end private def auth @auth ||= OpenStruct.new( login: login, password: password ) end def send_method! lambda { |method, args| RavencoinRpc::Client::Fetcher.new(url: url, payload: payload.call(method, args), auth: auth).result } end def payload ->(method, args) { prepare_and_check_data.call(method, args) } end def prepare_and_check_data lambda do |method, args| client_request.call(method, args).call end end def client_request ->(method, args) { RavencoinRpc::Client::Request.new(method: method, args: args) } end end end
Version data entries
4 entries across 4 versions & 1 rubygems