Class: Status
- Includes:
- ValueEquality
- Defined in:
- lib/jirametrics/status.rb
Instance Attribute Summary collapse
-
#category_id ⇒ Object
readonly
Returns the value of attribute category_id.
-
#category_name ⇒ Object
readonly
Returns the value of attribute category_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
Instance Method Summary collapse
- #artificial? ⇒ Boolean
- #global? ⇒ Boolean
-
#initialize(name: nil, id: nil, category_name: nil, category_id: nil, project_id: nil, raw: nil) ⇒ Status
constructor
A new instance of Status.
- #project_scoped? ⇒ Boolean
- #to_s ⇒ Object
- #value_equality_ignored_variables ⇒ Object
Methods included from ValueEquality
Constructor Details
#initialize(name: nil, id: nil, category_name: nil, category_id: nil, project_id: nil, raw: nil) ⇒ Status
Returns a new instance of Status.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jirametrics/status.rb', line 10 def initialize name: nil, id: nil, category_name: nil, category_id: nil, project_id: nil, raw: nil @name = name @id = id @category_name = category_name @category_id = category_id @project_id = project_id return unless raw @raw = raw @name = raw['name'] @id = raw['id'].to_i category_config = raw['statusCategory'] @category_name = category_config['name'] @category_id = category_config['id'].to_i # If this is a NextGen project then this status may be project specific. When this field is # nil then the status is global. @project_id = raw['scope']&.[]('project')&.[]('id') end |
Instance Attribute Details
#category_id ⇒ Object (readonly)
Returns the value of attribute category_id.
7 8 9 |
# File 'lib/jirametrics/status.rb', line 7 def category_id @category_id end |
#category_name ⇒ Object (readonly)
Returns the value of attribute category_name.
7 8 9 |
# File 'lib/jirametrics/status.rb', line 7 def category_name @category_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/jirametrics/status.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/jirametrics/status.rb', line 8 def name @name end |
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
7 8 9 |
# File 'lib/jirametrics/status.rb', line 7 def project_id @project_id end |
Instance Method Details
#artificial? ⇒ Boolean
51 52 53 |
# File 'lib/jirametrics/status.rb', line 51 def artificial? @raw.nil? end |
#global? ⇒ Boolean
36 37 38 |
# File 'lib/jirametrics/status.rb', line 36 def global? !project_scoped? end |
#project_scoped? ⇒ Boolean
32 33 34 |
# File 'lib/jirametrics/status.rb', line 32 def project_scoped? !!@project_id end |
#to_s ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/jirametrics/status.rb', line 40 def to_s result = "Status(name=#{@name.inspect}," \ " id=#{@id.inspect}," \ " category_name=#{@category_name.inspect}," \ " category_id=#{@category_id.inspect}," \ " project_id=#{@project_id}" result << ' artificial' if artificial? result << ')' result end |
#value_equality_ignored_variables ⇒ Object
55 56 57 |
# File 'lib/jirametrics/status.rb', line 55 def value_equality_ignored_variables [:@raw] end |