Class: Microclimate::Repository
- Extended by:
- Forwardable
- Defined in:
- lib/microclimate/repository.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#repo_id ⇒ Object
Returns the value of attribute repo_id.
Instance Method Summary collapse
- #branch_for(branch_name) ⇒ Object
-
#initialize(client, options) ⇒ Repository
constructor
A new instance of Repository.
- #last_snapshot ⇒ Object
- #previous_snapshot ⇒ Object
- #ready? ⇒ Boolean
-
#refresh! ⇒ Object
Force Code Climate to refresh this repository (at the master branch).
- #status ⇒ Object
- #www_url ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(client, options) ⇒ Repository
Returns a new instance of Repository.
11 12 13 14 |
# File 'lib/microclimate/repository.rb', line 11 def initialize(client, ) @client = client @repo_id = [:repo_id] end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/microclimate/repository.rb', line 5 def client @client end |
#repo_id ⇒ Object
Returns the value of attribute repo_id.
5 6 7 |
# File 'lib/microclimate/repository.rb', line 5 def repo_id @repo_id end |
Instance Method Details
#branch_for(branch_name) ⇒ Object
36 37 38 |
# File 'lib/microclimate/repository.rb', line 36 def branch_for(branch_name) Branch.new(client, self, branch_name) end |
#last_snapshot ⇒ Object
44 45 46 47 48 |
# File 'lib/microclimate/repository.rb', line 44 def last_snapshot snapshot = status.last_snapshot return nil if snapshot.nil? Snapshot.new(snapshot) end |
#previous_snapshot ⇒ Object
50 51 52 53 54 55 |
# File 'lib/microclimate/repository.rb', line 50 def previous_snapshot snapshot = status.previous_snapshot return nil if snapshot.nil? Snapshot.new(snapshot) end |
#ready? ⇒ Boolean
26 27 28 |
# File 'lib/microclimate/repository.rb', line 26 def ready? !last_snapshot.nil? end |
#refresh! ⇒ Object
Force Code Climate to refresh this repository (at the master branch)
21 22 23 24 |
# File 'lib/microclimate/repository.rb', line 21 def refresh! output = connection.post resource_refresh_url, :api_token => api_token output.success? end |
#status ⇒ Object
30 31 32 33 34 |
# File 'lib/microclimate/repository.rb', line 30 def status output = connection.get resource_url, :api_token => api_token json = output.body Response.new JSON.parse(json) end |
#www_url ⇒ Object
40 41 42 |
# File 'lib/microclimate/repository.rb', line 40 def www_url "https://codeclimate.com/repos/#{repo_id}" end |