Sha256: 7c596de5537faaed34327840c70dfcb5ba956ad2bbbd629580c76996293bde1c
Contents?: true
Size: 1019 Bytes
Versions: 2
Compression:
Stored size: 1019 Bytes
Contents
# encoding: utf-8 require 'jiralicious/configuration' module Jiralicious class Session include HTTParty format :json headers 'Content-Type' => 'application/json' def request(method, *options) if options.last.is_a?(Hash) && options.last[:handler] response_handler = options.last.delete(:handler) else response_handler = handler end self.class.base_uri Jiralicious.uri before_request if respond_to?(:before_request) response = self.class.send(method, *options) after_request(response) if respond_to?(:after_request) response_handler.call(response) end private def handler Proc.new do |response| case response when 200..204 response.body else message = response.body if message.is_a?(Hash) message = message['errorMessages'].join('\n') end Jiralicious::JiraError.new(message) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jiralicious-0.2.0 | lib/jiralicious/session.rb |
jiralicious-0.1.0 | lib/jiralicious/session.rb |