class GSVersionApiProvider

Public Class Methods

getVersions() click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 101
def self.getVersions()
  url = 'versions?platform=ios'
  response = @@client.request(:get) do |req|
    req.url url
    req.headers['Content-Type'] = 'application/json'
  end

  if response.success?
    GSVersionValue.parseBackendResponse(response.body)
  else
    raise(@@client.class.hostname + url + ' ' + response.status.to_s + ' ' + response.body['message'])
  end
end
updateVersions(projectName, newValue = GSVersionValue.versions_dict[projectName]) click to toggle source
# File lib/fastlane/plugin/gs_versioning/helper/gs_version_api_provider.rb, line 115
def self.updateVersions(projectName, newValue = GSVersionValue.versions_dict[projectName])
  require 'json'
  GSVersionValue.versions_dict[projectName] = newValue
  url = 'versions'
  json_params = {
      'alias' => projectName,
      'betaVersionName' => newValue['beta'],
      'rcVersionName' => newValue['rc'],
      'releaseVersionName' => newValue['release']
  }
  response = @@client.request(:patch) do |req|
    req.url url
    req.body = json_params.to_json
    req.headers['Content-Type'] = 'application/json'
  end

  if response.success?
    return response
  else
    raise(@@client.class.hostname + url + ' ' + response.status.to_s + ' ' + response.body['message'])
  end
end