Class: YkIosCmd::YkGitlab
- Inherits:
-
Object
- Object
- YkIosCmd::YkGitlab
- Includes:
- HTTParty
- Defined in:
- lib/yk_command/gitlab/yk_gitlab.rb
Instance Method Summary collapse
- #create_project(name, description) ⇒ Object
- #delete_project(id) ⇒ Object
- #get_all_app ⇒ Object
- #get_all_components ⇒ Object
- #get_group_projects(group_id, per_page, page) ⇒ Object
- #get_project_commits(project_id, page, per_page) ⇒ Object
- #get_third_party_lib_projects ⇒ Object
-
#initialize(config) ⇒ YkGitlab
constructor
A new instance of YkGitlab.
- #search_project(name) ⇒ Object
Constructor Details
#initialize(config) ⇒ YkGitlab
Returns a new instance of YkGitlab.
9 10 11 12 13 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 9 def initialize(config) @config = config self.class.base_uri @config[:uri] @token = @config[:token] end |
Instance Method Details
#create_project(name, description) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 38 def create_project(name, description) self.class.post( "/projects", query: { "private_token" => @token }, body: { "name" => name, "namespace_id" => 514, "description" => description }.to_json ) end |
#delete_project(id) ⇒ Object
73 74 75 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 73 def delete_project(id) self.class.delete("/projects/#{id}", query: { "private_token" => @token }) end |
#get_all_app ⇒ Object
15 16 17 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 15 def get_all_app get_group_projects 917, 100, 0 end |
#get_all_components ⇒ Object
19 20 21 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 19 def get_all_components get_group_projects 514, 100, 0 end |
#get_group_projects(group_id, per_page, page) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 27 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 |
#get_project_commits(project_id, page, per_page) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 52 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 |
#get_third_party_lib_projects ⇒ Object
23 24 25 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 23 def get_third_party_lib_projects get_group_projects 873, 100, 0 end |
#search_project(name) ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/yk_command/gitlab/yk_gitlab.rb', line 63 def search_project(name) self.class.get( "/projects", query: { "private_token" => @token, :"search" => name } ) end |