Sha256: 1ad002fd234e36a9e646ed93754a0a357395f9922c605b433d55678f4fa1b983
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# encoding: utf-8 module Jiralicious ## # Provides the interface to access the JQL search functionality. # Uses the same syntax as Rest interface for JQL criteria. # # [Arguments] # :jql (required) JQL string # # :start_at (optional) offset to start at # # :max_results (optional) maximum number to return # # :fields (optional) field options # def search(jql, options = {}) options[:start_at] ||= 0 options[:max_results] ||= 50 options[:fields] = [options[:fields]] if options[:fields].is_a? String options[:fields] ||= ["*navigable"] request_body = { :jql => jql, :startAt => options[:start_at], :maxResults => options[:max_results], :fields => options[:fields] }.to_json handler = Proc.new do |response| if response.code == 200 Jiralicious::SearchResult.new(response) else raise Jiralicious::JqlError.new(response['errorMessages'].join('\n')) end end Jiralicious.session.request( :post, "#{Jiralicious.rest_path}/search", :body => request_body, :handler => handler ) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jiralicious-0.5.0 | lib/jiralicious/search.rb |
jiralicious-0.4.3 | lib/jiralicious/search.rb |
jiralicious-0.4.0 | lib/jiralicious/search.rb |