Module: Pepper::Connection::ClassMethods
- Defined in:
- lib/pepper/connection.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
12 13 14 |
# File 'lib/pepper/connection.rb', line 12 def connection @connection end |
Instance Method Details
#connect ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pepper/connection.rb', line 25 def connect sock = TCPSocket.new( @server, @port ) ssl_context = OpenSSL::SSL::SSLContext.new ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE self.connection = OpenSSL::SSL::SSLSocket.new( sock, ssl_context ) self.connection.sync_close self.connection.connect @parser = StreamParser.new self.connection @parser.get_frame self.connection end |
#settings=(opts = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pepper/connection.rb', line 14 def settings=(opts = {}) @server = opts[:server] @tag = opts[:tag] @password = opts[:password] @port = opts[:port] || 700 @lang = opts[:lang] || "en" @logged_in = false @parser = nil end |
#write(xml) ⇒ Object
40 41 42 43 |
# File 'lib/pepper/connection.rb', line 40 def write(xml) (@parser && self.connection || self.connect).write(xml) @parser.get_frame end |