Sha256: 1e41c50e3027f53f5abe63748d34a216350bfd52838b205ccba94851a460be68

Contents?: true

Size: 546 Bytes

Versions: 7

Compression:

Stored size: 546 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, 'clientId' => 'http'} 
        message['signature'] = Faye::Authentication.sign(message, key)
        message['data'] = data
        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

7 entries across 7 versions & 1 rubygems

Version Path
faye-authentication-1.8.0 lib/faye/authentication/http_client.rb
faye-authentication-1.7.0 lib/faye/authentication/http_client.rb
faye-authentication-1.6.1 lib/faye/authentication/http_client.rb
faye-authentication-1.6.0 lib/faye/authentication/http_client.rb
faye-authentication-0.4.0 lib/faye/authentication/http_client.rb
faye-authentication-0.3.0 lib/faye/authentication/http_client.rb
faye-authentication-0.2.0 lib/faye/authentication/http_client.rb