Class: ActiveDocument::MarkLogicHTTP
- Inherits:
-
Object
- Object
- ActiveDocument::MarkLogicHTTP
- Defined in:
- lib/ActiveDocument/mark_logic_http.rb
Instance Method Summary collapse
-
#initialize(uri, user_name, password) ⇒ MarkLogicHTTP
constructor
A new instance of MarkLogicHTTP.
- #send_xquery(xquery) ⇒ Object
Constructor Details
#initialize(uri, user_name, password) ⇒ MarkLogicHTTP
Returns a new instance of MarkLogicHTTP.
65 66 67 68 69 |
# File 'lib/ActiveDocument/mark_logic_http.rb', line 65 def initialize(uri, user_name, password) @url = URI.parse(uri) @user_name = user_name @password = password end |
Instance Method Details
#send_xquery(xquery) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/ActiveDocument/mark_logic_http.rb', line 71 def send_xquery(xquery) if xquery.nil? or xquery.empty? then return nil end req = authenticate() req.set_form_data({'request'=>"#{xquery}"}) res = Net::HTTP.new(@url.host, @url.port).start {|http| http.request(req) } case res when Net::HTTPSuccess, Net::HTTPRedirection # puts res.body res.body else res.error! end end |