class AtlassianAppVersions::App

Represents an application on jira.atlassian.com / my.atlassian.com

Constants

VALID_PRODUCTS

Public Class Methods

new(key) click to toggle source
# File lib/atlassian_app_versions.rb, line 229
def initialize(key)
    if !VALID_PRODUCTS.member? key then
        raise "Unknown product: #{key}. Use one of #{VALID_PRODUCTS.join(", ")}"
    end
    if key=="stash" then key="bitbucket"; end
    super
end

Public Instance Methods

allVersions() click to toggle source
# File lib/atlassian_app_versions.rb, line 266
def allVersions
    first=true
    versionsJSON.collect { |v|
        if first then
            first=false
            LatestAppVersion.new(v["version"], self)
        else
            ArchivedAppVersion.new(v["version"], self)
        end
    }
end
archivedReleaseJSON() click to toggle source
# File lib/atlassian_app_versions.rb, line 252
def archivedReleaseJSON
    if !@archivedReleaseJSON then
        macKey = @key == "bitbucket" ? "stash" : @key # MAC still thinks it's 'stash'
        url="https://my.atlassian.com/download/feeds/archived/#{macKey}.json"
        jsonStr = getjson(url)
        @archivedReleaseJSON = JSON.parse( jsonStr )
    end
    @archivedReleaseJSON
end
getjson(url) click to toggle source
# File lib/atlassian_app_versions.rb, line 237
def getjson(url)
    open(url).read.gsub(/^downloads\(/, '').gsub(/\)$/, '')
end
latestReleaseJSON() click to toggle source
# File lib/atlassian_app_versions.rb, line 241
def latestReleaseJSON
    if !@latestReleaseJSON then

        macKey = @key == "bitbucket" ? "stash" : @key # MAC still thinks it's 'stash'
        url="https://my.atlassian.com/download/feeds/current/#{macKey}.json"
        jsonStr = getjson(url)
        @latestReleaseJSON = JSON.parse(jsonStr)
    end
    @latestReleaseJSON
end
product_type() click to toggle source
# File lib/atlassian_app_versions.rb, line 278
def product_type
    "applications"
end
versionsJSON() click to toggle source
# File lib/atlassian_app_versions.rb, line 262
def versionsJSON
    marketplaceJSON["versions"]
end