Class: GrammarServer
- Inherits:
-
Object
- Object
- GrammarServer
- Defined in:
- lib/nugramserver-ruby/nugramserver-ruby.rb
Overview
An object of this class acts as a proxy to NuGram Hosted Server.
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #create_session(username, password) ⇒ Object
- #get_url ⇒ Object
-
#initialize(host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_PORT) ⇒ GrammarServer
constructor
A new instance of GrammarServer.
Constructor Details
#initialize(host = DEFAULT_SERVER_HOST, port = DEFAULT_SERVER_PORT) ⇒ GrammarServer
Returns a new instance of GrammarServer.
28 29 30 31 |
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 28 def initialize(host=DEFAULT_SERVER_HOST, port=DEFAULT_SERVER_PORT) @host = host @port = port end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
26 27 28 |
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 26 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
26 27 28 |
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 26 def port @port end |
Instance Method Details
#create_session(username, password) ⇒ Object
37 38 39 |
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 37 def create_session(username, password) GrammarServerSession.new(self, username, password) end |
#get_url ⇒ Object
33 34 35 |
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 33 def get_url "http://#{@host}:#{@port}" end |