Class: ProbeDockProbe::Project
- Inherits:
-
Object
- Object
- ProbeDockProbe::Project
- Defined in:
- lib/probe_dock_ruby/project.rb
Instance Attribute Summary collapse
-
#api_id ⇒ Object
Returns the value of attribute api_id.
-
#category ⇒ Object
Returns the value of attribute category.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#tickets ⇒ Object
Returns the value of attribute tickets.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Project
constructor
A new instance of Project.
- #update(options = {}) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Project
Returns a new instance of Project.
6 7 8 |
# File 'lib/probe_dock_ruby/project.rb', line 6 def initialize = {} update end |
Instance Attribute Details
#api_id ⇒ Object
Returns the value of attribute api_id.
4 5 6 |
# File 'lib/probe_dock_ruby/project.rb', line 4 def api_id @api_id end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/probe_dock_ruby/project.rb', line 4 def category @category end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/probe_dock_ruby/project.rb', line 4 def end |
#tickets ⇒ Object
Returns the value of attribute tickets.
4 5 6 |
# File 'lib/probe_dock_ruby/project.rb', line 4 def tickets @tickets end |
#version ⇒ Object
Returns the value of attribute version.
4 5 6 |
# File 'lib/probe_dock_ruby/project.rb', line 4 def version @version end |
Instance Method Details
#update(options = {}) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/probe_dock_ruby/project.rb', line 10 def update = {} %w(version api_id category).each do |k| instance_variable_set "@#{k}", [k.to_sym] ? [k.to_sym].to_s : nil if .key? k.to_sym end = wrap([:tags]).compact if .key? :tags @tickets = wrap([:tickets]).compact if .key? :tickets end |
#validate! ⇒ Object
18 19 20 21 22 |
# File 'lib/probe_dock_ruby/project.rb', line 18 def validate! required = { "version" => @version, "API identifier" => @api_id } missing = required.inject([]){ |memo,(k,v)| v.to_s.strip.length <= 0 ? memo << k : memo } raise PayloadError.new("Missing project options: #{missing.join ', '}") if missing.any? end |