Class: Lita::GithubPrList::PullRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/github_pr_list/pull_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ PullRequest

Returns a new instance of PullRequest.



8
9
10
11
12
13
14
15
16
17
# File 'lib/lita/github_pr_list/pull_request.rb', line 8

def initialize(params = {})
  self.response = params.fetch(:response, nil)
  github_token = params.fetch(:github_token, nil)
  self.github_organization = params.fetch(:github_organization, nil)
  self.github_pull_requests = []

  raise "invalid params in #{self.class.name}" if response.nil? || github_token.nil? || github_organization.nil?

  self.github_client = Octokit::Client.new(access_token: github_token, auto_paginate: true)
end

Instance Attribute Details

#github_clientObject

Returns the value of attribute github_client.



6
7
8
# File 'lib/lita/github_pr_list/pull_request.rb', line 6

def github_client
  @github_client
end

#github_organizationObject

Returns the value of attribute github_organization.



6
7
8
# File 'lib/lita/github_pr_list/pull_request.rb', line 6

def github_organization
  @github_organization
end

#github_pull_requestsObject

Returns the value of attribute github_pull_requests.



6
7
8
# File 'lib/lita/github_pr_list/pull_request.rb', line 6

def github_pull_requests
  @github_pull_requests
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/lita/github_pr_list/pull_request.rb', line 6

def response
  @response
end

Instance Method Details

#listObject



19
20
21
22
# File 'lib/lita/github_pr_list/pull_request.rb', line 19

def list
  get_pull_requests
  build_summary
end