Sha256: 3a1ea98bb1e5007c3fc7ede26640a6d8cdc055091655c49ec95389d7668ac1fb

Contents?: true

Size: 846 Bytes

Versions: 27

Compression:

Stored size: 846 Bytes

Contents

module Workarea
  module LatestVersion
    def self.get
      Rails.cache.fetch('workarea/version/latest', expires_in: 3.days) do
        request = Net::HTTP::Get.new('/api/v1/gems/workarea.json')
        request.content_type = 'application/json'

        uri = URI('https://rubygems.org')
        http = Net::HTTP.new(uri.host, uri.port)
        http.use_ssl = true
        http.verify_mode = OpenSSL::SSL::VERIFY_NONE
        response = http.start { |h| h.request(request) }

        JSON.parse(response.body)['version']
      end
    rescue Exception => e
      Rails.logger.error '-------------------------------------'
      Rails.logger.error "There was an error contacting rubygems.org!"
      Rails.logger.error e.class
      Rails.logger.error e.message
      Rails.logger.error '-------------------------------------'
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-core-3.5.27 lib/workarea/latest_version.rb
workarea-core-3.5.26 lib/workarea/latest_version.rb
workarea-core-3.5.25 lib/workarea/latest_version.rb
workarea-core-3.5.23 lib/workarea/latest_version.rb
workarea-core-3.5.22 lib/workarea/latest_version.rb
workarea-core-3.5.21 lib/workarea/latest_version.rb
workarea-core-3.5.20 lib/workarea/latest_version.rb
workarea-core-3.5.19 lib/workarea/latest_version.rb
workarea-core-3.5.18 lib/workarea/latest_version.rb
workarea-core-3.5.17 lib/workarea/latest_version.rb
workarea-core-3.5.16 lib/workarea/latest_version.rb
workarea-core-3.5.15 lib/workarea/latest_version.rb
workarea-core-3.5.14 lib/workarea/latest_version.rb
workarea-core-3.5.13 lib/workarea/latest_version.rb
workarea-core-3.5.12 lib/workarea/latest_version.rb
workarea-core-3.5.11 lib/workarea/latest_version.rb
workarea-core-3.5.10 lib/workarea/latest_version.rb
workarea-core-3.5.9 lib/workarea/latest_version.rb
workarea-core-3.5.8 lib/workarea/latest_version.rb
workarea-core-3.5.7 lib/workarea/latest_version.rb