class Gitgut::Jira::Request

Wrapper around a JQL query for JIR

Constants

DEFAULT_OPTIONS
JQL_PARAM_NAME

Public Class Methods

new(query) click to toggle source
# File lib/gitgut/jira.rb, line 83
def initialize(query)
  @query = query
end

Public Instance Methods

auth_options() click to toggle source
# File lib/gitgut/jira.rb, line 102
def auth_options
  {
    username: Settings.jira.username,
    password: Settings.jira.password
  }
end
perform!() click to toggle source

TODO: Maybe use a flag like performed? and store the response in an attr_reader

# File lib/gitgut/jira.rb, line 89
def perform!
  options = DEFAULT_OPTIONS.merge(
    basic_auth: auth_options
  )
  HTTParty.get(url, options)
end
url() click to toggle source
# File lib/gitgut/jira.rb, line 96
def url
  url = URI.parse(Settings.jira.endpoint)
  url.query = "#{JQL_PARAM_NAME}=#{URI.escape(@query)}"
  url
end