Class: Carson::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/carson/delivery.rb

Constant Summary collapse

ACTIVE_STATES =
%w[preparing gated queued integrating escalated].freeze
BLOCKED_STATES =
%w[gated escalated].freeze
READY_STATES =
%w[queued].freeze
TERMINAL_STATES =
%w[integrated failed superseded].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, repository:, branch:, head:, worktree_path:, authority:, status:, pull_request_number:, pull_request_url:, revision_count:, cause:, summary:, created_at:, updated_at:, integrated_at:, superseded_at:) ⇒ Delivery

Returns a new instance of Delivery.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/carson/delivery.rb', line 13

def initialize(
	id:, repository:, branch:, head:, worktree_path:, authority:, status:,
	pull_request_number:, pull_request_url:, revision_count:, cause:, summary:,
	created_at:, updated_at:, integrated_at:, superseded_at:
)
	@id = id
	@repository = repository
	@branch = branch
	@head = head
	@worktree_path = worktree_path
	@authority = authority
	@status = status
	@pull_request_number = pull_request_number
	@pull_request_url = pull_request_url
	@revision_count = revision_count
	@cause = cause
	@summary = summary
	@created_at = created_at
	@updated_at = updated_at
	@integrated_at = integrated_at
	@superseded_at = superseded_at
end

Instance Attribute Details

#authorityObject (readonly)

Returns the value of attribute authority.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def authority
  @authority
end

#branchObject (readonly)

Returns the value of attribute branch.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def branch
  @branch
end

#causeObject (readonly)

Returns the value of attribute cause.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def cause
  @cause
end

#created_atObject (readonly)

Returns the value of attribute created_at.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def created_at
  @created_at
end

#headObject (readonly)

Returns the value of attribute head.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def head
  @head
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def id
  @id
end

#integrated_atObject (readonly)

Returns the value of attribute integrated_at.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def integrated_at
  @integrated_at
end

#pull_request_numberObject (readonly)

Returns the value of attribute pull_request_number.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def pull_request_number
  @pull_request_number
end

#pull_request_urlObject (readonly)

Returns the value of attribute pull_request_url.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def pull_request_url
  @pull_request_url
end

#repositoryObject (readonly)

Returns the value of attribute repository.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def repository
  @repository
end

#revision_countObject (readonly)

Returns the value of attribute revision_count.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def revision_count
  @revision_count
end

#statusObject (readonly)

Returns the value of attribute status.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def status
  @status
end

#summaryObject (readonly)

Returns the value of attribute summary.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def summary
  @summary
end

#superseded_atObject (readonly)

Returns the value of attribute superseded_at.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def superseded_at
  @superseded_at
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def updated_at
  @updated_at
end

#worktree_pathObject (readonly)

Returns the value of attribute worktree_path.



9
10
11
# File 'lib/carson/delivery.rb', line 9

def worktree_path
  @worktree_path
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/carson/delivery.rb', line 36

def active?
	ACTIVE_STATES.include?( status )
end

#blocked?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/carson/delivery.rb', line 40

def blocked?
	BLOCKED_STATES.include?( status )
end

#failed?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/carson/delivery.rb', line 52

def failed?
	status == "failed"
end

#integrated?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/carson/delivery.rb', line 48

def integrated?
	status == "integrated"
end

#ready?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/carson/delivery.rb', line 44

def ready?
	READY_STATES.include?( status )
end

#superseded?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/carson/delivery.rb', line 56

def superseded?
	status == "superseded"
end

#terminal?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/carson/delivery.rb', line 60

def terminal?
	TERMINAL_STATES.include?( status )
end