Sha256: c9e2b5bbabd711c84b7994b8a674b0fa08a6f4a6513ab92fb33dbd18296aeda5

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

require "tracker_api"

module GetToWork
  class Service
    class PivotalTracker < GetToWork::Service
      @yaml_key = "pivotal_tracker"
      @name = "PivotalTracker"
      @display_name = "Pivotal Tracker"

      def authenticate(username:, password:, subdomain:_)
        @api_token = ::PivotalTracker::Client.token(username, password)
      end

      def authenticate_with_keychain
        if keychain
          set_client_token(keychain.password)
        end
      end

      def set_client_token(token)
        @api_token = token
      end

      def api_token
        @api_token ||= authenticate_with_keychain
      end

      def api_client
        @api_client ||= TrackerApi::Client.new(token: @api_token)
      end

      def projects
        @projects ||= get_projects
      end

      def get_projects
        api_client.projects
      end

      def story(story_id)
        api_client.project(@project_id).story(story_id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
get_to_work-0.1.0 lib/get_to_work/service/pivotal_tracker.rb