lib/flow/cli/utils/api/flow_api_manager.rb in flow-cli-0.0.4 vs lib/flow/cli/utils/api/flow_api_manager.rb in flow-cli-0.0.5
- old
+ new
@@ -69,9 +69,19 @@
def fetch_flow(flow_id, project_id)
send_to_api(:get, "/flows/#{flow_id}", project_id: project_id)
end
+ def fetch_latest_jobs(flow_id, project_id)
+ answer = send_to_api(:get, "/projects/#{project_id}/jobs", flow_id: flow_id)
+ answer[:list] || []
+ end
+
+ def run_manual_job(flow_id, project_id, branch)
+ send_to_api(:post, "/projects/#{project_id}/manual_hook", flow_id: flow_id, branch: branch)
+ end
+
+
def send_to_api(action, url, params = {}, slice_items = nil, need_access_token = true)
params[:access_token] = user_access_token if need_access_token
params.compact!
raw_answer = FlowApiRest.send(action, url, params)