Class: GitlabApi::ApiClient
- Inherits:
-
Object
- Object
- GitlabApi::ApiClient
- Defined in:
- lib/git/gitlab/api/issue.rb,
lib/git/gitlab/apiclient.rb,
lib/git/gitlab/api/authorize.rb,
lib/git/gitlab/api/mergerequest.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Authorize, Issue, Mergerequest
Constant Summary collapse
- API_VERSION =
"v3"- USER_AGENT =
"nyonyonyonyonyo! Gitlab nyo!!"
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
-
#initialize ⇒ ApiClient
constructor
A new instance of ApiClient.
Constructor Details
#initialize ⇒ ApiClient
Returns a new instance of ApiClient.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/git/gitlab/apiclient.rb', line 12 def initialize @repository = Grit::Repo.new(`git rev-parse --show-toplevel`.chomp) config = @repository.config url = config["gitlab.url"] if url == nil raise "Plase set 'git config gitlab.url ${Gitlab URL}'" end token = config["gitlab.token"] if token == nil raise "Please set 'git config gitlab.token ${Gitlab Token}'" end Gitlab.configure do |config| config.endpoint = "#{url}/api/#{API_VERSION}" config.private_token = token config.user_agent = USER_AGENT end @client = Gitlab.client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/git/gitlab/apiclient.rb', line 10 def client @client end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
10 11 12 |
# File 'lib/git/gitlab/apiclient.rb', line 10 def repository @repository end |