Sha256: 1612c60a63df733ef24d3a1d32998933178b903f3a3f308d46928fda5918c762

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require 'octokit'
require 'furik/core_ext/string'
require 'furik/configurable'
require 'furik/pull_requests'
require 'furik/events'
require "furik/version"

module Furik
  class << self
    def gh_client
      Octokit::Client.new Configurable.github_octokit_options
    end

    def ghe_client
      Octokit::Client.new Configurable.github_enterprise_octokit_options
    end

    def events_with_grouping(gh: true, ghe: true, from: nil, to: nil, &block)
      events = []

      if gh
        gh_events = Events.new(gh_client).events_with_grouping(from, to, &block)
        events.concat gh_events if gh_events.is_a?(Array)
      end

      if ghe
        ghe_events = Events.new(ghe_client).events_with_grouping(from, to, &block)
        events.concat ghe_events if ghe_events.is_a?(Array)
      end

      events
    end

    def pull_requests(gh: true, ghe: true, &block)
      pulls = []

      if gh
        gh_pulls = PullRequests.new(gh_client).all(&block)
        pulls.concat gh_pulls if gh_pulls.is_a?(Array)
      end

      if ghe
        ghe_pulls = PullRequests.new(ghe_client).all(&block)
        pulls.concat ghe_pulls if ghe_pulls.is_a?(Array)
      end

      pulls
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
furik-0.2.0 lib/furik.rb
furik-0.1.4 lib/furik.rb
furik-0.1.3 lib/furik.rb
furik-0.1.2 lib/furik.rb
furik-0.1.1 lib/furik.rb
furik-0.1.0 lib/furik.rb