gitlab-org--gitlab-foss/lib/version_check.rb
Robert Speicher 04a3e48c2a
Use class methods for VersionCheck
All of these methods are stateless, there was no point to have them as
instance methods.

Mostly this allows us to remove an `allow_any_instance_of` usage.
2018-12-14 13:56:03 -06:00

21 lines
400 B
Ruby

# frozen_string_literal: true
require "base64"
# This class is used to build image URL to
# check if it is a new version for update
class VersionCheck
def self.data
{ version: Gitlab::VERSION }
end
def self.url
encoded_data = Base64.urlsafe_encode64(data.to_json)
"#{host}?gitlab_info=#{encoded_data}"
end
def self.host
'https://version.gitlab.com/check.svg'
end
end