require "httparty" module YkIosCmd class YkGitlab include HTTParty headers "Content-Type" => "application/json" def initialize(config) @config = config self.class.base_uri @config[:uri] @token = @config[:token] end def get_all_app get_group_projects 917, 100, 0 end def get_all_components get_group_projects 514, 100, 0 end def get_third_party_lib_projects get_group_projects 873, 100, 0 end def get_group_projects(group_id, per_page, page) self.class.get( "/groups/#{group_id}", query: { "private_token" => @token, "per_page" => per_page, "page" => page } ) end def create_project(name, description) self.class.post( "/projects", query: { "private_token" => @token }, body: { "name" => name, "namespace_id" => 514, "description" => description }.to_json ) end def get_project_commits(project_id, page, per_page) self.class.get( "/projects/#{project_id}/repository/commits", query: { "private_token" => @token, "per_page" => per_page, "page" => page } ) end def search_project(name) self.class.get( "/projects", query: { "private_token" => @token, :"search" => name } ) end def delete_project(id) self.class.delete("/projects/#{id}", query: { "private_token" => @token }) end end end