Class: Circler::Build
- Inherits:
-
Object
- Object
- Circler::Build
- Defined in:
- lib/circler/response/build.rb
Class Method Summary collapse
- .all(username, reponame) ⇒ Object
- .branch(username, reponame, branch) ⇒ Object
- .get(username, reponame, number) ⇒ Object
Instance Method Summary collapse
- #information ⇒ Object
-
#initialize(hash) ⇒ Build
constructor
A new instance of Build.
- #reponame ⇒ Object
- #steps ⇒ Object
- #username ⇒ Object
Constructor Details
#initialize(hash) ⇒ Build
Returns a new instance of Build.
21 22 23 |
# File 'lib/circler/response/build.rb', line 21 def initialize(hash) @hash = hash end |
Class Method Details
.all(username, reponame) ⇒ Object
4 5 6 7 8 |
# File 'lib/circler/response/build.rb', line 4 def all(username, reponame) CircleCi::Project.recent_builds(username, reponame) .body .map { |b| Build.new(b) } end |
Instance Method Details
#information ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/circler/response/build.rb', line 33 def information [ @hash['build_num'], colorize_by_status(@hash['status'], @hash['status']), colorize_by_status(@hash['branch'], @hash['status']), @hash['author_name'], (@hash['subject'] || '').slice(0..60), format_time(@hash['build_time_millis']), @hash['start_time'], ] end |
#reponame ⇒ Object
29 30 31 |
# File 'lib/circler/response/build.rb', line 29 def reponame @hash['reponame'] end |
#steps ⇒ Object
45 46 47 48 |
# File 'lib/circler/response/build.rb', line 45 def steps hash = @hash['steps'].group_by { |s| s['actions'].first['type'] } hash.flat_map { |type, value| value.map{ |v| Step.new(type, v) }} end |
#username ⇒ Object
25 26 27 |
# File 'lib/circler/response/build.rb', line 25 def username @hash['username'] end |