Class: Solr::Request::Mlt
Instance Method Summary collapse
- #content_type ⇒ Object
- #handler ⇒ Object
-
#initialize(params) ⇒ Mlt
constructor
A new instance of Mlt.
- #response_format ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(params) ⇒ Mlt
Returns a new instance of Mlt.
3 4 5 |
# File 'lib/solr/request/mlt.rb', line 3 def initialize(params) @params = params end |
Instance Method Details
#content_type ⇒ Object
15 16 17 |
# File 'lib/solr/request/mlt.rb', line 15 def content_type 'application/x-www-form-urlencoded; charset=utf-8' end |
#handler ⇒ Object
11 12 13 |
# File 'lib/solr/request/mlt.rb', line 11 def handler 'mlt' end |
#response_format ⇒ Object
7 8 9 |
# File 'lib/solr/request/mlt.rb', line 7 def response_format :ruby end |
#to_hash ⇒ Object
19 20 21 |
# File 'lib/solr/request/mlt.rb', line 19 def to_hash @params.update(:wt => 'ruby') end |
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/solr/request/mlt.rb', line 23 def to_s raw_params = self.to_hash http_params = [] raw_params.each do |key,value| if value.respond_to?(:each) && !value.is_a?(String) value.each { |v| http_params << "#{key}=#{ERB::Util::url_encode(v)}" unless v.nil?} else http_params << "#{key}=#{ERB::Util::url_encode(value)}" unless value.nil? end end http_params.join("&") end |