class Checklister::Github::Project

Constants

DEFAULT_OPTIONS

Default options that we want to pass when querying the github project index

Public Class Methods

new(client) click to toggle source

Initialize a github project instance

@example Get a project's data

project = Checklister::Project.new(gitlab_client).get(1)

@param client [Object] an instance of Checklister::Client

# File lib/checklister/github/project.rb, line 38
def initialize(client)
  @client = client
end

Public Instance Methods

all(options = {}) click to toggle source

Get all github's projects @param options [optional, Hash] query options @return [Array] and array of project's properties as Hash

# File lib/checklister/github/project.rb, line 52
def all(options = {})
  query_options = DEFAULT_OPTIONS.merge options
  repositories = @client.repositories(query_options)
  repositories.map { |p| ProjectDecorator.new(p).to_hash }
end
filtered_by_name(name, _options = {}) click to toggle source

Get github's projects based on a search string (LIKE on project#name) @param name [String] partial project's name @return [Array] and array of project's properties as Hash

# File lib/checklister/github/project.rb, line 61
def filtered_by_name(name, _options = {})
  all.select { |p| p[:name].downcase.include? name.downcase }
end
get(project_id) click to toggle source

Query a particular project based on it's id @param project_id [Integer] github project id @return [Hash] a project properties

# File lib/checklister/github/project.rb, line 45
def get(project_id)
  ProjectDecorator.new(@client.repository(project_id)).to_hash
end