Class: PullRequestAi::Repo::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pull_request_ai/repo/client.rb

Direct Known Subclasses

Bitbucket::Client, GitHub::Client

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_timeout, api_endpoint) ⇒ Client

Initializes the client.



11
12
13
14
# File 'lib/pull_request_ai/repo/client.rb', line 11

def initialize(http_timeout, api_endpoint)
  @http_timeout = http_timeout
  @api_endpoint = api_endpoint
end

Instance Attribute Details

#api_endpointObject

Returns the value of attribute api_endpoint.



7
8
9
# File 'lib/pull_request_ai/repo/client.rb', line 7

def api_endpoint
  @api_endpoint
end

#http_timeoutObject (readonly)

Returns the value of attribute http_timeout.



6
7
8
# File 'lib/pull_request_ai/repo/client.rb', line 6

def http_timeout
  @http_timeout
end

Class Method Details

.client_from_host(host) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pull_request_ai/repo/client.rb', line 29

def client_from_host(host)
  result = host.success? ? host.success : ''
  case result
  when 'github.com'
    PullRequestAi::GitHub::Client.new
  when 'bitbucket.org'
    PullRequestAi::Bitbucket::Client.new
  else
    PullRequestAi::Repo::Client.new
  end
end

Instance Method Details

#open_pull_request(slug, head, base, title, description) ⇒ Object



24
25
26
# File 'lib/pull_request_ai/repo/client.rb', line 24

def open_pull_request(slug, head, base, title, description)
  Error.failure(:project_not_configured)
end

#opened_pull_requests(slug, head, base) ⇒ Object



16
17
18
# File 'lib/pull_request_ai/repo/client.rb', line 16

def opened_pull_requests(slug, head, base)
  Error.failure(:project_not_configured)
end

#update_pull_request(slug, number, base, title, description) ⇒ Object



20
21
22
# File 'lib/pull_request_ai/repo/client.rb', line 20

def update_pull_request(slug, number, base, title, description)
  Error.failure(:project_not_configured)
end