Class: PivotalAPI::StoryTransition
- Defined in:
- lib/pivotal-tracker-api/story_transition.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
-
#performed_by_id ⇒ Object
Returns the value of attribute performed_by_id.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#project_version ⇒ Object
Returns the value of attribute project_version.
-
#state ⇒ Object
Returns the value of attribute state.
-
#story_id ⇒ Object
Returns the value of attribute story_id.
Class Method Summary collapse
- .from_json(json) ⇒ Object
- .parse_json_story_transition(json_story_transition) ⇒ Object
- .parse_json_story_transitions(json_story_transitions) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from PivotalAPI::Base
Instance Attribute Details
#kind ⇒ Object
Returns the value of attribute kind.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def kind @kind end |
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def occurred_at @occurred_at end |
#performed_by_id ⇒ Object
Returns the value of attribute performed_by_id.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def performed_by_id @performed_by_id end |
#project_id ⇒ Object
Returns the value of attribute project_id.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def project_id @project_id end |
#project_version ⇒ Object
Returns the value of attribute project_version.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def project_version @project_version end |
#state ⇒ Object
Returns the value of attribute state.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def state @state end |
#story_id ⇒ Object
Returns the value of attribute story_id.
26 27 28 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 26 def story_id @story_id end |
Class Method Details
.from_json(json) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 30 def from_json(json) return nil unless json if json.is_a?(Array) parse_json_story_transitions(json) else parse_json_story_transition(json) end end |
.parse_json_story_transition(json_story_transition) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 47 def parse_json_story_transition(json_story_transition) new({ state: json_story_transition[:state], story_id: json_story_transition[:story_id].to_i, project_id: json_story_transition[:project_id].to_i, project_version: json_story_transition[:project_version].to_i, occurred_at: (DateTime.parse(json_story_transition[:occurred_at]) if json_story_transition[:occurred_at]), performed_by_id: json_story_transition[:performed_by_id].to_i, kind: json_story_transition[:kind] }) end |
.parse_json_story_transitions(json_story_transitions) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/pivotal-tracker-api/story_transition.rb', line 39 def parse_json_story_transitions(json_story_transitions) transitions = [] json_story_transitions.each do |transition| transitions << parse_json_story_transition(transition) end transitions end |