Class: Travis::Client::Artifact
- Defined in:
- lib/travis/client/artifact.rb
Constant Summary collapse
- CHUNKED =
"application/json; chunked=true; version=2, application/json; version=2"
- TEXT =
"#{CHUNKED}, text/plain"
Constants inherited from Entity
Instance Attribute Summary collapse
-
#body(stream = block_given?) ) ⇒ Object
readonly
Returns the value of attribute body.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#job_id ⇒ Object
readonly
Returns the value of attribute job_id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Entity
#attributes, #curry, #id, #session
Instance Method Summary collapse
- #clean_body ⇒ Object
- #colorized_body ⇒ Object
- #current_body ⇒ Object
- #delete_body(reason = {}) ⇒ Object
- #encoded_body ⇒ Object
- #pusher_entity ⇒ Object
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
#body(stream = block_given?) ) ⇒ Object (readonly)
Returns the value of attribute body.
1 2 3 |
# File 'lib/travis/client/artifact.rb', line 1 def body @body end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
1 2 3 |
# File 'lib/travis/client/artifact.rb', line 1 def job @job end |
#job_id ⇒ Object (readonly)
Returns the value of attribute job_id.
1 2 3 |
# File 'lib/travis/client/artifact.rb', line 1 def job_id @job_id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
1 2 3 |
# File 'lib/travis/client/artifact.rb', line 1 def type @type end |
Instance Method Details
#clean_body ⇒ Object
34 35 36 |
# File 'lib/travis/client/artifact.rb', line 34 def clean_body attributes['clean_body'] ||= Tools::SafeString.clean(body) end |
#colorized_body ⇒ Object
30 31 32 |
# File 'lib/travis/client/artifact.rb', line 30 def colorized_body attributes['colorized_body'] ||= Tools::SafeString.colorized(body) end |
#current_body ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/travis/client/artifact.rb', line 38 def current_body attributes['current_body'] ||= begin body = load_attribute('body') if body.to_s.empty? log = session.get_raw("jobs/#{job_id}/log", nil, "Accept" => TEXT) body = String === log ? log : log['log']['body'] end body end end |
#delete_body(reason = {}) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/travis/client/artifact.rb', line 17 def delete_body(reason = {}) reason = { :reason => reason } unless reason.is_a? Hash session.patch_raw("jobs/#{job_id}/log", reason) reload rescue Travis::Client::Error => error raise unless error. == '409' self end |
#encoded_body ⇒ Object
26 27 28 |
# File 'lib/travis/client/artifact.rb', line 26 def encoded_body Tools::SafeString.encoded(body) end |
#pusher_entity ⇒ Object
79 80 81 |
# File 'lib/travis/client/artifact.rb', line 79 def pusher_entity job end |