Sha256: 791347f3f1a005aabc7dab71cd2b773a875e8f6c976d5300a8e92526afa9c443

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

require 'releaseable/http'

module Releaseable
  module Loggly

    def self.search domain, user, pass, query

      query = {:q => query} if query.is_a?(String)

      response = HTTP.get "http://#{domain}.loggly.com/api/search", user, pass,
                          query.is_a?(Hash) ? query : {:q => query}

      parsed = JSON.parse(response.body)

      if parsed['data']
        parsed['data'].map { |entry| JSON.parse(entry.delete('text')).merge(entry) }
      else
        parsed
      end
    end

  end # module Loggly
end # module Releaseable

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
releaseable-0.0.22 lib/releaseable/loggly.rb
releaseable-0.0.21 lib/releaseable/loggly.rb
releaseable-0.0.20 lib/releaseable/loggly.rb