Sha256: f3530f8a0d1fbdd0d6338bc7ee58f70e9d1f85a632bed865077b84d48e6798a0

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

# encoding: utf-8
module Jiralicious
  def search(jql, options = {})
    options[:start_at] ||= 0
    options[:max_results] ||= 50

    request_body = {
      :jql => jql,
      :startAt => options[:start_at],
      :maxResults => options[:max_results]
    }.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

1 entries across 1 versions & 1 rubygems

Version Path
jiralicious-0.1.0 lib/jiralicious/search.rb