Class: Cups::Connection
- Inherits:
-
Object
- Object
- Cups::Connection
- Extended by:
- Gem::Deprecate
- Defined in:
- lib/ffi-cups/connection.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
-
.close(http) ⇒ Object
Closes the http connection and autoreleases the pointer Wrapper around Http#httpClose.
Instance Method Summary collapse
-
#httpConnect2 ⇒ Pointer
Wrapper around Http#httpConnect2 Creates a http connection to a print server.
-
#httpConnectEncrypt ⇒ Pointer
deprecated
Deprecated.
Use #httpConnect2 instead
-
#initialize(hostname, port = nil) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(hostname, port = nil) ⇒ Connection
Returns a new instance of Connection.
7 8 9 10 |
# File 'lib/ffi-cups/connection.rb', line 7 def initialize(hostname, port=nil) @hostname = hostname @port = port.nil? ? 631 : port end |
Instance Attribute Details
#hostname ⇒ Object
Returns the value of attribute hostname.
5 6 7 |
# File 'lib/ffi-cups/connection.rb', line 5 def hostname @hostname end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/ffi-cups/connection.rb', line 5 def port @port end |
Class Method Details
.close(http) ⇒ Object
Closes the http connection and autoreleases the pointer Wrapper around Http#httpClose
34 35 36 |
# File 'lib/ffi-cups/connection.rb', line 34 def self.close(http) Cups::Http.httpClose(http) end |
Instance Method Details
#httpConnect2 ⇒ Pointer
Wrapper around Http#httpConnect2 Creates a http connection to a print server
25 26 27 28 29 |
# File 'lib/ffi-cups/connection.rb', line 25 def httpConnect2 http = Cups::Http.httpConnect2(hostname, port, nil, 0, Cups.cupsEncryption(), 1, 30000, nil) raise "Print server at #{hostname}:#{port} is not available" if http.null? return http end |
#httpConnectEncrypt ⇒ Pointer
Deprecated.
Use #httpConnect2 instead
Wrapper around Http#httpConnectEncrypt
15 16 17 18 19 |
# File 'lib/ffi-cups/connection.rb', line 15 def httpConnectEncrypt http = Cups::Http.httpConnectEncrypt(hostname, port, Cups.cupsEncryption()) raise "Print server at #{hostname}:#{port} is not available" if http.null? return http end |