Class: Checklister::Gitlab::Project
- Inherits:
-
Object
- Object
- Checklister::Gitlab::Project
- Defined in:
- lib/checklister/gitlab/project.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
Default options that we want to pass when querying the gitlab project index
{ order_by: "id", sort: "asc", per_page: "200" }
Instance Method Summary collapse
-
#all(options = {}) ⇒ Array
Get all gitlab's projects.
-
#filtered_by_name(name, options = {}) ⇒ Array
Get gitlab's projects based on a search string (LIKE on project#name).
-
#get(project_id) ⇒ Hash
Query a particular project based on it's id.
-
#initialize(client) ⇒ Project
constructor
Initialize a gitlab project instance.
Constructor Details
#initialize(client) ⇒ Project
Initialize a gitlab project instance
36 37 38 |
# File 'lib/checklister/gitlab/project.rb', line 36 def initialize(client) @client = client end |
Instance Method Details
#all(options = {}) ⇒ Array
Get all gitlab's projects
50 51 52 53 |
# File 'lib/checklister/gitlab/project.rb', line 50 def all( = {}) = DEFAULT_OPTIONS.merge @client.projects().map { |p| ProjectDecorator.new(p).to_hash } end |
#filtered_by_name(name, options = {}) ⇒ Array
Get gitlab's projects based on a search string (LIKE on project#name)
59 60 61 62 |
# File 'lib/checklister/gitlab/project.rb', line 59 def filtered_by_name(name, = {}) = DEFAULT_OPTIONS.merge @client.project_search(name, ).map { |p| ProjectDecorator.new(p).to_hash } end |
#get(project_id) ⇒ Hash
Query a particular project based on it's id
43 44 45 |
# File 'lib/checklister/gitlab/project.rb', line 43 def get(project_id) ProjectDecorator.new(@client.project(project_id)).to_hash end |