Sha256: f85d0022995ce2fba690b8ca1d7397009067a218e21b70c79fc5e09e4dd5d61c
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
require 'octoauth' require 'octokit' require 'faraday-http-cache' ## # Define Tasks and related objects for Taskit module Taskit ## # Cache layer for GitHub API API_CACHE = Faraday::RackBuilder.new do |builder| builder.use Faraday::HttpCache builder.use Octokit::Response::RaiseError builder.adapter Faraday.default_adapter end ## # Tasks object holds and returns information on open issues class Tasks include Taskit::Filters include Taskit::Display attr_reader :issues def initialize(params = {}) @options = params @client = params[:client] @issues = params[:issues] end def issues @issues ||= client.issues(nil, filter: :all).map do |issue| Taskit::Issue.new issue end end def to_s "<Taskit::Tasks for #{client.login}>" end alias_method :inspect, :to_s private def token @token ||= Octoauth.new( note: 'Taskit', api_endpoint: @options[:api_endpoint], file: :default, autosave: true, scopes: ['repo'] ).token end def client @client ||= Octokit::Client.new( access_token: token, api_endpoint: @options[:api_endpoint], web_endpoint: @options[:api_endpoint], auto_paginate: true ) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
taskit-0.0.3 | lib/taskit/tasks.rb |