Class: Dev::TargetProcess::Release

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

Overview

Class containing release information

Constant Summary collapse

RESOURCE_TYPE =

The resource type for the api endpoint

'Release'.freeze
PATH =

The api path for release requests

'/Releases'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Release

Returns a new instance of Release.



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

def initialize(data)
  @data = data
  @id = data['Id']
  @type = data['ResourceType']
  @name = data['Name']
  @start_date = parse_time(data['StartDate'])
  @end_date = parse_time(data['EndDate'])
  @custom_fields = data['CustomFields']
end

Instance Attribute Details

#custom_fieldsObject

Returns the value of attribute custom_fields.



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

def custom_fields
  @custom_fields
end

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/firespring_dev_commands/target_process/release.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/release.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/release.rb', line 11

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#start_dateObject

Returns the value of attribute start_date.



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

def start_date
  @start_date
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#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/release.rb', line 24

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

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