Sha256: f69e06748aab76793f8a61148f692c5dd96fda9cf1c7d2f37f935084cdd18171

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

require 'peekj'
require 'http'

module Peekj
  class JiraApi
    def self.get_issue(issue_key)
      response = new.get("issue/#{issue_key}")

      OpenStruct.new(
        summary: response['fields']['summary']
      )
    end

    def get(relative_path)
      HTTP.basic_auth(auth_params).get("#{base_url}#{relative_path}").parse
    end

    private

    def auth_params
      @auth_params ||= {user: Credentials.username, pass: Credentials.api_token}
    end

    def base_url
      app_url = Credentials.app_url

      "#{app_url}/rest/api/latest/"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
peekj-0.1.0 lib/peekj/jira_api.rb