Class: GrammarServer

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



26
27
28
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 26

def host
  @host
end

#portObject (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_urlObject



33
34
35
# File 'lib/nugramserver-ruby/nugramserver-ruby.rb', line 33

def get_url
  "http://#{@host}:#{@port}"
end