Sha256: f7d16e90f0126edd3afb5b40db343519a88c877cfdfa4babd92c575da86d5d77

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

require 'json'

module Faye
  module Authentication
    class HTTPClient

      def self.publish(url, channel, data, key)
        uri = URI(url)
        req = Net::HTTP::Post.new(url)
        message = {'channel' => channel, 'data' => data, 'clientId' => 'http'}
        message['signature'] = Faye::Authentication.sign(message, key)
        req.set_form_data(message: JSON.dump(message))
        Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') { |http| http.request(req) }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
faye-authentication-0.1.0 lib/faye/authentication/http_client.rb