class TelegramBot::GitHubWrapper::Repository
Attributes
description[R]
issues[R]
private?[R]
private_repo[R]
repository[R]
username[R]
Public Class Methods
find(username:, repository:)
click to toggle source
Find a particular repository
# File lib/telegram-bot/github_wrapper.rb, line 52 def self.find(username:, repository:) response = get("/#{username}/#{repository}", headers: @@headers) if response.success? self.new(username: username, repository: repository, description: response.fetch("description", ""), private_repo: response.fetch("private", "")) else raise response.response end end
new(username:, repository:, description:, private_repo:)
click to toggle source
# File lib/telegram-bot/github_wrapper.rb, line 14 def initialize(username:, repository:, description:, private_repo:) @username = username @repository = repository @description = description @private_repo = private_repo @issues = [] end
Public Instance Methods
get_issues(state: 'all', sort: "created", order_direction: 'asc')
click to toggle source
Returns the issues from a public repository
# File lib/telegram-bot/github_wrapper.rb, line 25 def get_issues(state: 'all', sort: "created", order_direction: 'asc') query = { "state" => state, "sort" => sort, "direction" => order_direction } response = self.class.get("/#{@username}/#{@repository}/issues", headers: @@headers, query: query) if response.success? JSON.parse(response.body).each do |issue| @issues << Issue.new(id: issue.fetch('id', ''), number: issue.fetch('number', ''), title: issue.fetch('title', ''), body: issue.fetch('body', ''), state: issue.fetch('state', ''), url: issue.fetch('url', '')) end else raise response.response end @issues end