Class: GithubIssueRequest::Url

Inherits:
Object
  • Object
show all
Defined in:
lib/github_issue_request/url.rb

Constant Summary collapse

GITHUB_BASE_URL =
"https://github.com"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GithubIssueRequest::Url

Parameters:

  • options (Hash) (defaults to: {})

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/github_issue_request/url.rb', line 14

def initialize(options = {})
  _options = options.dup

  owner = _options.delete(:owner)
  repo = _options.delete(:repo)
  @owner = owner || @@owner
  @repo = repo || @@repo
  @options = _options
  raise NotSetOwnerRepoError if @owner.nil? || @repo.nil?

  @url = "#{GITHUB_BASE_URL}/#{@owner}/#{@repo}/issues/new"
  @url += "?#{@options.to_query}" unless _options.empty?
end

Class Method Details

.config(owner, repo) ⇒ Object



6
7
8
9
# File 'lib/github_issue_request/url.rb', line 6

def config(owner, repo)
  @@owner = owner
  @@repo = repo
end

Instance Method Details

#to_sString

Returns:

  • (String)


29
30
31
# File 'lib/github_issue_request/url.rb', line 29

def to_s
  @url
end