Class: Flo::Provider::GithubFlo
- Inherits:
-
Base
- Object
- Base
- Flo::Provider::GithubFlo
- Defined in:
- lib/flo/provider/github_flo.rb
Instance Method Summary collapse
-
#add_labels_to_an_issue(opts = {}) ⇒ Object
Adds labels to a Github Issue.
-
#create_pull_request(opts = {}) ⇒ Object
Creates a Github pull request.
-
#initialize(opts = {}) ⇒ GithubFlo
constructor
Creates a new GithubFlo Provider instance.
-
#issue(opts = {}) ⇒ Sawyer::Resource
Provides an Octokit issue.
-
#update_issue(opts = {}) ⇒ Object
Updates a Github issue.
Constructor Details
#initialize(opts = {}) ⇒ GithubFlo
Creates a new GithubFlo Provider instance
20 21 22 23 24 25 26 |
# File 'lib/flo/provider/github_flo.rb', line 20 def initialize(opts={}) username = opts[:user] token = opts[:token] @repo = opts[:repo] @client = opts[:client] || Octokit::Client.new(login: username, password: token) end |
Instance Method Details
#add_labels_to_an_issue(opts = {}) ⇒ Object
Adds labels to a Github Issue
Remaining options will be passed to octokit. See octokit’s documentation for updating issues
49 50 51 52 53 |
# File 'lib/flo/provider/github_flo.rb', line 49 def add_labels_to_an_issue(opts={}) = {repo: @repo}.merge(opts) @client.add_labels_to_an_issue(.delete(:repo), .delete(:number), [:labels]) OpenStruct.new(success?: true) end |
#create_pull_request(opts = {}) ⇒ Object
Creates a Github pull request
Remaining options will be passed to octokit. See octokit’s documentation for updating issues
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/flo/provider/github_flo.rb', line 77 def create_pull_request(opts={}) repo = opts[:repo] || @repo @client.create_pull_request( repo, opts.delete(:base), opts.delete(:head), opts.delete(:title), opts.delete(:body) ) OpenStruct.new(success?: true) end |
#issue(opts = {}) ⇒ Sawyer::Resource
Provides an Octokit issue. This is helpful when you want to take some other action based on the state of an issue.
63 64 65 66 |
# File 'lib/flo/provider/github_flo.rb', line 63 def issue(opts={}) = {repo: @repo}.merge(opts) @client.issue([:repo], [:number]) end |
#update_issue(opts = {}) ⇒ Object
Updates a Github issue
Remaining options will be passed to octokit. See octokit’s documentation for updating issues
35 36 37 38 39 |
# File 'lib/flo/provider/github_flo.rb', line 35 def update_issue(opts={}) = {repo: @repo}.merge(opts) @client.update_issue(.delete(:repo), .delete(:number), ) OpenStruct.new(success?: true) end |