Class: Binford::Github
- Inherits:
-
WebService
- Object
- WebService
- Binford::Github
- Defined in:
- lib/binford/github.rb
Instance Method Summary collapse
-
#initialize(token:) ⇒ Github
constructor
A new instance of Github.
- #project_cards(column_id) ⇒ Object
- #project_columns(project_id) ⇒ Object
- #project_story_points(column_id) ⇒ Object
- #projects(owner, repo) ⇒ Object
Methods inherited from WebService
Constructor Details
#initialize(token:) ⇒ Github
Returns a new instance of Github.
7 8 9 10 |
# File 'lib/binford/github.rb', line 7 def initialize(token:) super("https://api.github.com", serializer: Serializers::Json.new) @token = token end |
Instance Method Details
#project_cards(column_id) ⇒ Object
20 21 22 |
# File 'lib/binford/github.rb', line 20 def project_cards(column_id) get("/projects/columns/#{column_id}/cards") end |
#project_columns(project_id) ⇒ Object
16 17 18 |
# File 'lib/binford/github.rb', line 16 def project_columns(project_id) get("/projects/#{project_id}/columns") end |
#project_story_points(column_id) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/binford/github.rb', line 24 def project_story_points(column_id) regex = /SP:\s*(\d+\.*\d*)/ project_cards(column_id)&.map do |data| (data[:note] || get(data[:content_url].sub(base_url, ""))[:body]).scan(regex).flatten.first end&.compact end |
#projects(owner, repo) ⇒ Object
12 13 14 |
# File 'lib/binford/github.rb', line 12 def projects(owner, repo) get("repos/#{owner}/#{repo}/projects") end |