Class: PactBroker::UI::ViewDomain::MatrixLine
Instance Method Summary
collapse
Methods included from Messages
#message, #potential_duplicate_pacticipant_message, #validation_message
#badge_url_for_latest_pact, #build_webhook_metadata, #consumer_webhooks_url, #dashboard_url_for_integration, #decode_webhook_metadata, #encode_webhook_metadata, #group_url, #hal_browser_url, #integration_url, #label_url, #labels_url, #latest_pact_url, #latest_pacts_url, #latest_tagged_pact_url, #latest_untagged_pact_url, #latest_verification_for_pact_url, #latest_verifications_for_consumer_version_url, #latest_version_url, #matrix_badge_url_for_selectors, #matrix_for_pact_url, #matrix_for_pacticipant_version_url, #matrix_url, #matrix_url_from_params, #new_verification_url, #pact_triggered_webhooks_url, #pact_url, #pact_url_from_params, #pact_version_url, #pact_version_url_with_metadata, #pact_versions_url, #pacticipant_url, #pacticipant_url_from_params, #pacticipants_url, #previous_distinct_diff_url, #previous_distinct_pact_version_url, #provider_webhooks_url, #tag_url, #tags_url, #templated_diff_url, #templated_label_url_for_pacticipant, #templated_tag_url_for_pacticipant, #triggered_webhook_logs_url, #url_encode, #verification_publication_url, #verification_triggered_webhooks_url, #verification_url, #verification_url_from_params, #version_url, #version_url_from_params, #versions_url, #webhook_execution_url, #webhook_url, #webhooks_for_consumer_and_provider_url, #webhooks_for_pact_url, #webhooks_status_url, #webhooks_url
#build_metadata_for_latest_pact, #build_metadata_for_webhook_triggered_by_pact_publication
Constructor Details
#initialize(line, options = {}) ⇒ MatrixLine
Returns a new instance of MatrixLine.
15
16
17
18
19
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 15
def initialize line, options = {}
@line = line
@options = options
@overwritten = false end
|
Instance Method Details
#<=>(other) ⇒ Object
128
129
130
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 128
def <=> other
(orderable_fields <=> other.orderable_fields) * -1
end
|
#base_url ⇒ Object
187
188
189
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 187
def base_url
@options[:base_url]
end
|
#consumer_name ⇒ Object
29
30
31
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 29
def consumer_name
@line.consumer_name
end
|
#consumer_name_url ⇒ Object
33
34
35
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 33
def consumer_name_url
hal_browser_url(pacticipant_url_from_params({ pacticipant_name: consumer_name }, base_url), base_url)
end
|
#consumer_version_id ⇒ Object
54
55
56
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 54
def consumer_version_id
@line.consumer_version_id
end
|
#consumer_version_number ⇒ Object
62
63
64
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 62
def consumer_version_number
@line.consumer_version_number
end
|
#consumer_version_number_url ⇒ Object
70
71
72
73
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 70
def consumer_version_number_url
params = { pacticipant_name: consumer_name, version_number: consumer_version_number }
hal_browser_url(version_url_from_params(params, base_url), base_url)
end
|
#consumer_version_order ⇒ Object
75
76
77
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 75
def consumer_version_order
@line.consumer_version_order
end
|
#display_consumer_version_number ⇒ Object
#display_provider_version_number ⇒ Object
100
101
102
103
104
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 100
def latest_consumer_version_tags
@line.consumer_version_tags
.select(&:latest)
.collect{ | tag | MatrixTag.new(tag.to_hash.merge(pacticipant_name: consumer_name, version_number: consumer_version_number)) }
end
|
112
113
114
115
116
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 112
def latest_provider_version_tags
@line.provider_version_tags
.select(&:latest)
.collect{ | tag | MatrixTag.new(tag.to_hash.merge(pacticipant_name: provider_name, version_number: provider_version_number)) }
end
|
#number ⇒ Object
verification number, used in verification_url method
46
47
48
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 46
def number
@line.verification_number
end
|
#orderable_fields ⇒ Object
124
125
126
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 124
def orderable_fields
[@line.last_action_date, @line.pact_created_at]
end
|
106
107
108
109
110
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 106
def other_consumer_version_tags
@line.consumer_version_tags
.reject(&:latest)
.collect{ | tag | MatrixTag.new(tag.to_hash.merge(pacticipant_name: consumer_name, version_number: consumer_version_number)) }
end
|
118
119
120
121
122
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 118
def other_provider_version_tags
@line.provider_version_tags
.reject(&:latest)
.collect{ | tag | MatrixTag.new(tag.to_hash.merge(pacticipant_name: provider_name, version_number: provider_version_number)) }
end
|
#overwritten=(overwritten) ⇒ Object
177
178
179
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 177
def overwritten= overwritten
@overwritten = overwritten
end
|
#overwritten? ⇒ Boolean
173
174
175
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 173
def overwritten?
@overwritten
end
|
#pact_publication_date ⇒ Object
149
150
151
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 149
def pact_publication_date
relative_date(@line.pact_created_at)
end
|
#pact_publication_date_url ⇒ Object
153
154
155
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 153
def pact_publication_date_url
pact_url(base_url, @line)
end
|
#pact_published_order ⇒ Object
161
162
163
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 161
def pact_published_order
@line.pact_created_at.to_time.to_i
end
|
#pact_revision_number ⇒ Object
50
51
52
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 50
def pact_revision_number
@line.pact_revision_number
end
|
#pact_version_sha ⇒ Object
37
38
39
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 37
def pact_version_sha
@line.pact_version_sha
end
|
#pact_version_sha_message ⇒ Object
41
42
43
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 41
def pact_version_sha_message
"The highlighted pact(s) have content that has a SHA of #{pact_version_sha}"
end
|
#pre_verified_message ⇒ Object
181
182
183
184
185
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 181
def pre_verified_message
if @line.verification_executed_at && @line.pact_created_at > @line.verification_executed_at
message("messages.matrix.pre_verified")
end
end
|
#provider_name ⇒ Object
21
22
23
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 21
def provider_name
@line.provider_name
end
|
#provider_name_url ⇒ Object
25
26
27
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 25
def provider_name_url
hal_browser_url(pacticipant_url_from_params({ pacticipant_name: provider_name }, base_url), base_url)
end
|
#provider_version_id ⇒ Object
58
59
60
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 58
def provider_version_id
@line.provider_version_id
end
|
#provider_version_number ⇒ Object
79
80
81
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 79
def provider_version_number
@line.provider_version_number
end
|
#provider_version_number_url ⇒ Object
87
88
89
90
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 87
def provider_version_number_url
params = { pacticipant_name: provider_name, version_number: provider_version_number }
hal_browser_url(version_url_from_params(params, base_url), base_url)
end
|
#provider_version_order ⇒ Object
92
93
94
95
96
97
98
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 92
def provider_version_order
if @line.verification_executed_at
@line.verification_executed_at.to_time.to_i
else
0
end
end
|
#relative_date(date) ⇒ Object
#verification_status ⇒ Object
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 132
def verification_status
if @line.verification_executed_at
DateHelper.distance_of_time_in_words(@line.verification_executed_at, DateTime.now) + " ago"
else
''
end
end
|
#verification_status_class ⇒ Object
165
166
167
168
169
170
171
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 165
def verification_status_class
case @line.success
when true then 'success'
when false then 'danger'
else ''
end
end
|
#verification_status_url ⇒ Object
145
146
147
|
# File 'lib/pact_broker/ui/view_models/matrix_line.rb', line 145
def verification_status_url
hal_browser_url(verification_url(self, base_url), base_url)
end
|