Class: Rundeck::Job::JobExecutionQueryBuilder
- Inherits:
-
Object
- Object
- Rundeck::Job::JobExecutionQueryBuilder
- Defined in:
- lib/rundeck-ruby/job.rb
Defined Under Namespace
Classes: ValidationError
Instance Attribute Summary collapse
-
#max ⇒ Object
Returns the value of attribute max.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#max ⇒ Object
Returns the value of attribute max.
43 44 45 |
# File 'lib/rundeck-ruby/job.rb', line 43 def max @max end |
#offset ⇒ Object
Returns the value of attribute offset.
43 44 45 |
# File 'lib/rundeck-ruby/job.rb', line 43 def offset @offset end |
#status ⇒ Object
Returns the value of attribute status.
43 44 45 |
# File 'lib/rundeck-ruby/job.rb', line 43 def status @status end |
Class Method Details
.valid_statuses ⇒ Object
45 46 47 |
# File 'lib/rundeck-ruby/job.rb', line 45 def self.valid_statuses Execution::QueryBuilder.valid_statuses end |
Instance Method Details
#query ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rundeck-ruby/job.rb', line 63 def query validate clauses = [ status && "status=#{status}", max && "max=#{max.to_i}", offset && "offset=#{offset.to_i}", ].compact.join('&') "?#{clauses}".chomp('?') end |
#validate ⇒ Object
57 58 59 60 61 |
# File 'lib/rundeck-ruby/job.rb', line 57 def validate raise ValidationError.new("status", status) unless status.nil? || self.class.valid_statuses.include?(status.to_s) raise ValidationError.new("offset", offset) unless offset.nil? || offset.to_i >= 0 raise ValidationError.new("max", max) unless max.nil? || max.to_i >= 0 end |