Class: Travis::Client::Job
- Includes:
- Restartable, States
- Defined in:
- lib/travis/client/job.rb
Constant Summary
Constants included from States
Constants inherited from Entity
Instance Attribute Summary collapse
-
#allow_failure ⇒ Object
(also: #allow_failure?)
readonly
Returns the value of attribute allow_failure.
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#build ⇒ Object
readonly
Returns the value of attribute build.
-
#build_id ⇒ Object
readonly
Returns the value of attribute build_id.
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#commit_id ⇒ Object
readonly
Returns the value of attribute commit_id.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#finished_at ⇒ Object
readonly
Returns the value of attribute finished_at.
-
#log_id ⇒ Object
readonly
Returns the value of attribute log_id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#repository_id ⇒ Object
readonly
Returns the value of attribute repository_id.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Attributes inherited from Entity
#attributes, #curry, #id, #session
Instance Method Summary collapse
- #allow_failures? ⇒ Boolean
- #branch_info ⇒ Object
- #delete_log(reason = {}) ⇒ Object
- #duration ⇒ Object
- #inspect_info ⇒ Object
- #pull_request? ⇒ Boolean
- #push? ⇒ Boolean
- #pusher_channels ⇒ Object
Methods included from States
#canceled?, #color, #created?, #errored?, #failed?, #finished?, #green?, #passed?, #pending?, #queued?, #ready?, #received?, #red?, #running?, #started?, #unsuccessful?, #yellow?
Methods included from Restartable
#cancel, #cancelable?, #restart, #restartable?
Methods inherited from Entity
#[], #[]=, aka, #attribute_names, attributes, base_path, #cancelable?, cast_id, #complete?, has, has_singleton, id?, id_field, #include?, #initialize, #inspect, inspect_info, #load, many, #missing?, one, preloadable, preloadable?, relations, #relations, #reload, #restartable?, subclass_for, subclasses, time, #to_h, #update_attributes, weak?
Constructor Details
This class inherits a constructor from Travis::Client::Entity
Instance Attribute Details
#allow_failure ⇒ Object (readonly) Also known as: allow_failure?
Returns the value of attribute allow_failure.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def allow_failure @allow_failure end |
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def annotations @annotations end |
#build ⇒ Object (readonly)
Returns the value of attribute build.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def build @build end |
#build_id ⇒ Object (readonly)
Returns the value of attribute build_id.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def build_id @build_id end |
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def commit @commit end |
#commit_id ⇒ Object (readonly)
Returns the value of attribute commit_id.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def commit_id @commit_id end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def config @config end |
#finished_at ⇒ Object (readonly)
Returns the value of attribute finished_at.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def finished_at @finished_at end |
#log_id ⇒ Object (readonly)
Returns the value of attribute log_id.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def log_id @log_id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def number @number end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def queue @queue end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def repository @repository end |
#repository_id ⇒ Object (readonly)
Returns the value of attribute repository_id.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def repository_id @repository_id end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def started_at @started_at end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def state @state end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
1 2 3 |
# File 'lib/travis/client/job.rb', line 1 def @tags end |
Instance Method Details
#allow_failures? ⇒ Boolean
33 34 35 36 37 38 |
# File 'lib/travis/client/job.rb', line 33 def allow_failures? return false unless config.include? 'matrix' and config['matrix'].include? 'allow_failures' config['matrix']['allow_failures'].any? do |allow| allow.all? { |key, value| config[key] == value } end end |
#branch_info ⇒ Object
29 30 31 |
# File 'lib/travis/client/job.rb', line 29 def branch_info build.branch_info end |
#delete_log(reason = {}) ⇒ Object
48 49 50 |
# File 'lib/travis/client/job.rb', line 48 def delete_log(reason = {}) log.delete_body(reason) end |
#duration ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/travis/client/job.rb', line 40 def duration attributes['duration'] ||= begin start = started_at || Time.now finish = finished_at || Time.now (finish - start).to_i end end |
#inspect_info ⇒ Object
56 57 58 |
# File 'lib/travis/client/job.rb', line 56 def inspect_info "#{repository.slug}##{number}" end |
#pull_request? ⇒ Boolean
21 22 23 |
# File 'lib/travis/client/job.rb', line 21 def pull_request? build.pull_request? end |
#push? ⇒ Boolean
25 26 27 |
# File 'lib/travis/client/job.rb', line 25 def push? build.push? end |
#pusher_channels ⇒ Object
52 53 54 |
# File 'lib/travis/client/job.rb', line 52 def pusher_channels build.pusher_channels + ["job-#{id}"] end |