Class: TelegramBot::GitHubConnector
- Inherits:
-
Object
- Object
- TelegramBot::GitHubConnector
- Defined in:
- lib/telegram-bot/github.rb
Instance Attribute Summary collapse
-
#github_object ⇒ Object
readonly
Returns the value of attribute github_object.
-
#issues_list ⇒ Object
readonly
Returns the value of attribute issues_list.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #get_issues(state: 'open', order_mode: 'asc') ⇒ Object
-
#initialize(username:, repository:) ⇒ GitHubConnector
constructor
A new instance of GitHubConnector.
Constructor Details
#initialize(username:, repository:) ⇒ GitHubConnector
Returns a new instance of GitHubConnector.
8 9 10 11 12 13 |
# File 'lib/telegram-bot/github.rb', line 8 def initialize(username:, repository:) @github_object = Github.new @username = username @repository = repository @issues_list = [] end |
Instance Attribute Details
#github_object ⇒ Object (readonly)
Returns the value of attribute github_object.
6 7 8 |
# File 'lib/telegram-bot/github.rb', line 6 def github_object @github_object end |
#issues_list ⇒ Object (readonly)
Returns the value of attribute issues_list.
6 7 8 |
# File 'lib/telegram-bot/github.rb', line 6 def issues_list @issues_list end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
6 7 8 |
# File 'lib/telegram-bot/github.rb', line 6 def repository @repository end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
6 7 8 |
# File 'lib/telegram-bot/github.rb', line 6 def username @username end |
Instance Method Details
#get_issues(state: 'open', order_mode: 'asc') ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/telegram-bot/github.rb', line 15 def get_issues(state: 'open', order_mode: 'asc') begin issues = @github_object.issues.list user: @username, repo: @repository, state: state, sort: 'created', direction: order_mode issues.each do |issue| @issues_list << Issue.new(id: issue.id, number: issue.number, title: issue.title, body: issue.body, state: issue.state, url: issue.url) end rescue Github::Error::NotFound => exception @issues_list << "Usuario/Repositorio no encontrado" end @issues_list end |