Class: GitHubPr::Poster
- Inherits:
-
Object
- Object
- GitHubPr::Poster
- Defined in:
- lib/github-pr/poster.rb
Instance Method Summary collapse
-
#cut_scheme_and_host(url) ⇒ Object
github.com/user/reponame cutting path user/reponame.
-
#initialize(token) ⇒ Poster
constructor
A new instance of Poster.
- #post(client, options) ⇒ Object
- #repo_url ⇒ Object
Constructor Details
#initialize(token) ⇒ Poster
Returns a new instance of Poster.
5 6 7 |
# File 'lib/github-pr/poster.rb', line 5 def initialize(token) @token = token end |
Instance Method Details
#cut_scheme_and_host(url) ⇒ Object
github.com/user/reponame cutting path user/reponame
28 29 30 |
# File 'lib/github-pr/poster.rb', line 28 def cut_scheme_and_host(url) URI::parse(url).path[1..-1] end |
#post(client, options) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/github-pr/poster.rb', line 9 def post() client = Octokit::Client.new(:access_token => @token.get()) begin post(client, ) rescue Octokit::Unauthorized client = Octokit::Client.new(:access_token => @token.get(regenerate: true)) post(client, ) end end |
#repo_url ⇒ Object
31 32 33 |
# File 'lib/github-pr/poster.rb', line 31 def repo_url `git config --get remote.origin.url`.chomp end |