Class: Dev::TargetProcess::TeamAssignment

Inherits:
Object
  • Object
show all
Defined in:
lib/firespring_dev_commands/target_process/team_assignment.rb

Overview

Class containing project information

Constant Summary collapse

RESOURCE_TYPE =

The resource type for the api endpoint

'TeamAssignment'.freeze
PATH =

The api path for team assignment requests

'/TeamAssignments'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ TeamAssignment

Returns a new instance of TeamAssignment.



13
14
15
16
17
18
19
20
21
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 13

def initialize(data)
  @data = data
  @id = data['Id']
  @type = data['ResourceType']
  @start_date = parse_time(data['StartDate'])
  @end_date = parse_time(data['EndDate'])
  @team = Team.new(data['Team']) if data['Team']
  @story = UserStory.new(data['Assignable']) if data['Assignable']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def data
  @data
end

#end_dateObject

Returns the value of attribute end_date.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def end_date
  @end_date
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def id
  @id
end

#start_dateObject

Returns the value of attribute start_date.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def start_date
  @start_date
end

#storyObject

Returns the value of attribute story.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def story
  @story
end

#teamObject

Returns the value of attribute team.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def team
  @team
end

#typeObject

Returns the value of attribute type.



11
12
13
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 11

def type
  @type
end

Instance Method Details

#cycle_timeObject

Calculate the cycle time as the amount of time the story was open



31
32
33
34
35
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 31

def cycle_time
  return 1.0 unless start_date && end_date

  (end_date - start_date).to_f / (60 * 60 * 24)
end

#parse_time(string) ⇒ Object

Parse the dot net time representation into something that ruby can use



24
25
26
27
28
# File 'lib/firespring_dev_commands/target_process/team_assignment.rb', line 24

def parse_time(string)
  return nil unless string && !string.empty?

  ::Time.at(string.slice(6, 10).to_i)
end