Class: Backend
- Inherits:
-
Object
- Object
- Backend
- Defined in:
- lib/picky-live/backend.rb
Overview
Ruby Live Interface to the Picky search engine.
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #get(params = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Backend
constructor
A new instance of Backend.
Constructor Details
#initialize(options = {}) ⇒ Backend
Returns a new instance of Backend.
9 10 11 12 13 |
# File 'lib/picky-live/backend.rb', line 9 def initialize = {} @host = [:host] || 'localhost' @port = [:port] || 8080 @path = [:path] || '/admin' end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/picky-live/backend.rb', line 7 def host @host end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/picky-live/backend.rb', line 7 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/picky-live/backend.rb', line 7 def port @port end |
Instance Method Details
#get(params = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/picky-live/backend.rb', line 15 def get params = {} query_params = params.to_query query_params = "?#{query_params}" unless query_params.empty? Net::HTTP.get self.host, "#{self.path}#{query_params}", self.port end |