Class: Pod::Baselines_api
- Inherits:
-
Object
- Object
- Pod::Baselines_api
- Includes:
- Concurrent::Async
- Defined in:
- lib/cocoapods-vemars/services/baselines_api.rb
Constant Summary collapse
- BASELINES_URL =
'https://mars-fwk.vemarsdev.com/mpaas/baseline/baselines'.freeze
Instance Attribute Summary collapse
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
- #getBaselines(silent = false) ⇒ Object
-
#initialize(url = BASELINES_URL) ⇒ Baselines_api
constructor
A new instance of Baselines_api.
Constructor Details
#initialize(url = BASELINES_URL) ⇒ Baselines_api
Returns a new instance of Baselines_api.
10 11 12 |
# File 'lib/cocoapods-vemars/services/baselines_api.rb', line 10 public def initialize(url=BASELINES_URL) @baseline_url = (url.blank? ? BASELINES_URL : url + "/baseline/baselines") end |
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
8 9 10 |
# File 'lib/cocoapods-vemars/services/baselines_api.rb', line 8 def result @result end |
Instance Method Details
#getBaselines(silent = false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cocoapods-vemars/services/baselines_api.rb', line 14 def getBaselines(silent=false) 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 if !silent puts "Version list: #{@result}" end else puts "Error #{error_code}(#{json["error_msg"]}): #{json["err_detail"]}}" end else puts "response status: #{response.status_code}" end end |