class BitBroker::Publisher

Public Class Methods

new(config) click to toggle source
Calls superclass method BitBroker::Broker::new
# File lib/bitbroker/broker.rb, line 30
def initialize(config)
  super(config)
end

Public Instance Methods

send_data(data) click to toggle source
# File lib/bitbroker/broker.rb, line 34
def send_data(data)
  send(RKEY_DATA, data)
end
send_metadata(data) click to toggle source
# File lib/bitbroker/broker.rb, line 37
def send_metadata(data)
  send(RKEY_METADATA, data)
end
send_p_data(dest, data) click to toggle source
# File lib/bitbroker/broker.rb, line 40
def send_p_data(dest, data)
  send(RKEY_DATA + dest, data)
end
send_p_metadata(dest, data) click to toggle source
# File lib/bitbroker/broker.rb, line 43
def send_p_metadata(dest, data)
  send(RKEY_METADATA + dest, data)
end

Private Instance Methods

encode(data) click to toggle source
# File lib/bitbroker/broker.rb, line 55
def encode(data)
  cipher = OpenSSL::Cipher::Cipher.new(ENCRYPT_ALGORITHM)
  cipher.encrypt
  cipher.pkcs5_keyivgen(@passwd)
  cipher.update(data) + cipher.final
end
send(rkey, data) click to toggle source
# File lib/bitbroker/broker.rb, line 48
def send(rkey, data)
  @exchange.publish(encode(MessagePack.pack({
    'data' => data,
    'from' => Mac.addr,
  })), :routing_key => rkey)
end