Sha256: 258530782228d59e94c054b1502315e4cbdfe16f85da3758b7f692cecd0a4224

Contents?: true

Size: 1.49 KB

Versions: 12

Compression:

Stored size: 1.49 KB

Contents

# -*- coding: UTF-8 -*-
#
# Copyright 2014 PagerDuty, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require 'octokit'

module LitaGithub
  # Github handler common-use Octokit methods
  #
  # @author Tim Heckman <tim@pagerduty.com>
  module Octo
    # Accessor method for the Github access token in the config
    #
    # @author Tim Heckman <tim@pagerduty.com>
    # @return [String] the Github API access token
    def access_token
      config.access_token
    end

    # To be used to set up Octokit::Client when loading the Handler class
    #
    # @author Tim Heckman <tim@pagerduty.com>
    # @return [NilClass]
    def setup_octo(_)
      @@octo ||= Octokit::Client.new(access_token: access_token)
      @@octo.auto_paginate = true
      nil
    end

    # Object access method for Octokit client
    #
    # @author Tim Heckman <tim@pagerduty.com>
    # @return [Octokit::Client]
    # @example
    #  octo.create_team('PagerDuty', name: 'Example Group', perms:pull)
    def octo
      @@octo
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lita-github-0.3.0 lib/lita-github/octo.rb
lita-github-0.2.2 lib/lita-github/octo.rb
lita-github-0.2.1 lib/lita-github/octo.rb
lita-github-0.2.0 lib/lita-github/octo.rb
lita-github-0.1.2 lib/lita-github/octo.rb
lita-github-0.1.1 lib/lita-github/octo.rb
lita-github-0.1.0 lib/lita-github/octo.rb
lita-github-0.0.16 lib/lita-github/octo.rb
lita-github-0.0.15 lib/lita-github/octo.rb
lita-github-0.0.14 lib/lita-github/octo.rb
lita-github-0.0.13 lib/lita-github/octo.rb
lita-github-0.0.12 lib/lita-github/octo.rb