Class: Prpr::Repository::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/prpr/repository/github.rb

Class Method Summary collapse

Class Method Details

.access_tokenObject



35
36
37
# File 'lib/prpr/repository/github.rb', line 35

def access_token
  env[:github_access_token]
end

.api_endpointObject



27
28
29
# File 'lib/prpr/repository/github.rb', line 27

def api_endpoint
  "https://#{github_host}/api/v3" if github_host
end

.client_optionsObject



11
12
13
# File 'lib/prpr/repository/github.rb', line 11

def client_options
  client_options_with_nil_value.reject {|key, value| value.nil? }
end

.client_options_with_nil_valueObject



15
16
17
18
19
20
21
# File 'lib/prpr/repository/github.rb', line 15

def client_options_with_nil_value
  {
    access_token: access_token,
    api_endpoint: api_endpoint,
    web_endpoint: web_endpoint,
  }
end

.defaultObject



7
8
9
# File 'lib/prpr/repository/github.rb', line 7

def default
  Octokit::Client.new(client_options)
end

.envObject



31
32
33
# File 'lib/prpr/repository/github.rb', line 31

def env
  @env ||= Prpr::Config::Env.default
end

.github_hostObject



39
40
41
# File 'lib/prpr/repository/github.rb', line 39

def github_host
  env[:github_host]
end

.web_endpointObject



23
24
25
# File 'lib/prpr/repository/github.rb', line 23

def web_endpoint
  "https://#{github_host}/" if github_host
end