class FindCircleYml::GitHub::Service

Attributes

access_token[R]
organization[R]
user[R]

Public Class Methods

new(user, access_token, organization) click to toggle source
# File lib/find_circle_yml/github/service.rb, line 8
def initialize(user, access_token, organization)
  @user = user
  @access_token = access_token
  @organization = organization
end

Public Instance Methods

configuration_file(repository) click to toggle source
# File lib/find_circle_yml/github/service.rb, line 24
def configuration_file(repository)
  ConfigurationFile.new(
    client.contents(repository.name, path: 'circle.yml')[:html_url]
  )
rescue Octokit::NotFound
  nil
end
repositories() click to toggle source
# File lib/find_circle_yml/github/service.rb, line 14
def repositories
  client.organization_repositories(organization).map do |response|
    Repository.new(
      response[:full_name],
      response[:default_branch],
      response[:html_url]
    )
  end
end

Private Instance Methods

client() click to toggle source
# File lib/find_circle_yml/github/service.rb, line 34
def client
  Octokit.auto_paginate = true
  Octokit::Client.new(login: user, password: access_token)
end