Sha256: e4f67fffe3a8014c9bde5506b2d6af734ab2e07e7cfef9bbb80bfdb87cafc467

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require 'jira-ruby'
require_relative './fetch_current_tasks'
require_relative './move_task_to_list'
require_relative './get_task_name_by_id'

module Dude
  module ProjectManagement
    module Jira
      class Client
        include Settings

        attr_reader :client, :project

        def initialize
          options = {
            username: settings['ATLASSIAN_EMAIL'],
            password: settings['ATLASSIAN_TOKEN'],
            site: settings['ATLASSIAN_URL'],
            context_path: '',
            auth_type: :basic
          }

          @client = JIRA::Client.new(options)
          @project = client.Project.find(settings['ATLASSIAN_PROJECT_KEY'])
        end

        def respond_to_missing?(method_name, include_private = false)
          client.respond_to_missing?(method_name, include_private)
        end

        def method_missing(method, *args, &block)
          client.send(method, *args, &block)
        end

        def fetch_current_tasks
          FetchCurrentTasks.new(client).call
        end

        def move_task_to_list(id, list)
          MoveTaskToList.new(client, id: id, list_name: list).call
        end

        def get_task_name_by_id(id)
          GetTaskNameById.new(client, id: id).call
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dude-cli-2.0.7 lib/dude/project_management/jira/client.rb