class Pod::Baselines_api

Constants

BASELINES_URL

Attributes

result[RW]

Public Class Methods

new(url=BASELINES_URL) click to toggle source
# File lib/cocoapods-vemars/services/baselines_api.rb, line 10
       def initialize(url=BASELINES_URL)
  @baseline_url = (url.blank? ? BASELINES_URL : url + "mpaas/baseline/baselines")
end

Public Instance Methods

getBaselines() click to toggle source
# File lib/cocoapods-vemars/services/baselines_api.rb, line 14
def getBaselines
  body= "{\"technology_stack\": \"iOS\"}"
  header = {"ContentType" => 'application/json'}
  response = REST.post(@baseline_url, body, header)
  if response.ok?
    json = JSON.parse(response.body)
    error_code = json["error_no"]
    if error_code == 0
      @result = json["data"]['baselines']
      @result = @result.sort.reverse
      puts "Version list: #{@result}"
    else
      puts "Error #{error_code}(#{json["error_msg"]}): #{json["err_detail"]}}"
    end
  else
    puts "response status: #{response.status_code}"
  end
end