Class: Senju::Gitlab

Inherits:
Object
  • Object
show all
Defined in:
lib/senju/gitlab.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(access_token_or_hash) ⇒ Gitlab

Returns a new instance of Gitlab.



5
6
7
8
9
10
11
12
13
14
# File 'lib/senju/gitlab.rb', line 5

def initialize(access_token_or_hash)
  if access_token_or_hash.is_a? Hash
    options = access_token_or_hash
    endpoint ||= "https://#{options["host"]}/api/v4"
    @client = Gitlab.client(endpoint: endpoint, private_token: options["token"])
  else
    endpoint ||= "https://gitlab.com/api/v4"
    @client = Gitlab.client(endpoint: endpoint, private_token: access_token)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



16
17
18
# File 'lib/senju/gitlab.rb', line 16

def method_missing(method, *args, &block)
  client.send(method, *args, &block)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/senju/gitlab.rb', line 3

def client
  @client
end