Sha256: 0571c7ba09d80618f3e0b8ed2a05f6dbdbdd242e464c0d5e9aaba80a050071ba

Contents?: true

Size: 1.23 KB

Versions: 55

Compression:

Stored size: 1.23 KB

Contents

require 'pact_broker/api/pact_broker_urls'
require 'pact_broker/ui/helpers/url_helper'
require 'pact_broker/date_helper'

module PactBroker
  module UI
    module ViewDomain
      class MatrixTag

        include PactBroker::Api::PactBrokerUrls

        attr_reader :name, :pacticipant_name, :version_number

        def initialize params
          @name = params[:name]
          @pacticipant_name = params[:pacticipant_name]
          @version_number = params[:version_number]
          @created_at = params[:created_at]
          @latest = !!params[:latest]
        end

        def tooltip
          if @latest
            "This is the latest version of #{pacticipant_name} with tag \"#{@name}\". Tag created #{relative_date(@created_at)}."
          else
            "Tag created #{relative_date(@created_at)}. A more recent version of #{pacticipant_name} with tag \"#{name}\" exists."
          end
        end

        def url
          hal_browser_url("/pacticipants/#{ERB::Util.url_encode(pacticipant_name)}/versions/#{ERB::Util.url_encode(version_number)}/tags/#{ERB::Util.url_encode(name)}")
        end

        def relative_date date
          DateHelper.distance_of_time_in_words(date, DateTime.now) + " ago"
        end
      end
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.79.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.78.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.78.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.77.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.76.2 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.76.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.76.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.75.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.74.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.74.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.73.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.72.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.71.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.70.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.69.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.68.1 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.68.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.67.0 lib/pact_broker/ui/view_models/matrix_tag.rb
pact_broker-2.66.0 lib/pact_broker/ui/view_models/matrix_tag.rb