Class: CodeClimate
Overview
Instance Method Summary collapse
-
#get(*args) ⇒ Object
Expose some HTTParty class things.
-
#initialize(api_token) ⇒ CodeClimate
constructor
A new instance of CodeClimate.
- #repo_details(repo_id) ⇒ Object
- #repo_details_by_name(repo_name) ⇒ Object
- #repo_id(repo_name) ⇒ Object
- #repo_list ⇒ Object
Constructor Details
#initialize(api_token) ⇒ CodeClimate
Returns a new instance of CodeClimate.
11 12 13 |
# File 'lib/code_climate.rb', line 11 def initialize(api_token) self.class.default_params api_token: api_token end |
Instance Method Details
#get(*args) ⇒ Object
Expose some HTTParty class things
16 17 18 |
# File 'lib/code_climate.rb', line 16 def get(*args) self.class.get(*args) end |
#repo_details(repo_id) ⇒ Object
28 29 30 |
# File 'lib/code_climate.rb', line 28 def repo_details(repo_id) get("/repos/#{repo_id}") end |
#repo_details_by_name(repo_name) ⇒ Object
32 33 34 |
# File 'lib/code_climate.rb', line 32 def repo_details_by_name(repo_name) get("/repos/#{repo_id(repo_name)}") end |
#repo_id(repo_name) ⇒ Object
24 25 26 |
# File 'lib/code_climate.rb', line 24 def repo_id(repo_name) repo_list.find { |repo| repo["url"].include?(repo_name) }["id"] end |
#repo_list ⇒ Object
20 21 22 |
# File 'lib/code_climate.rb', line 20 def repo_list get('/repos') end |