Class: Gerry::Client

Inherits:
Object
  • Object
show all
Includes:
Api::Access, Api::Accounts, Api::Branches, Api::Changes, Api::Groups, Api::Projects, Api::Request, HTTParty
Defined in:
lib/gerry/client.rb

Overview

Client for gerrit request api

  • for anonymout user

client = Gerry::Client.new('http://gerrit.example.com')
  • for user/password

client = Gerry::Client.new('http://gerrit.example.com', 'username', 'password')

Instance Method Summary collapse

Methods included from Api::Request

#auth_url, #delete, #get, #map_options, #options, #post, #put

Methods included from Api::Branches

#branch, #branch_reflog, #branches, #create_branch

Methods included from Api::Projects

#create_project_access, #find_project, #get_head, #project_access, #project_commit, #project_file, #projects, #remove_project_access, #set_head

Methods included from Api::Groups

#add_to_group, #create_group, #group_members, #groups, #included_groups, #remove_from_group

Methods included from Api::Changes

#changes

Methods included from Api::Accounts

#account_capabilities, #account_info, #groups_for_account

Methods included from Api::Access

#access

Constructor Details

#initialize(url, username = nil, password = nil) ⇒ Client

Returns a new instance of Client.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gerry/client.rb', line 42

def initialize(url, username = nil, password = nil)
  self.class.base_uri(url)

  if username && password
    @username = username
    @password = password
  else
    require 'netrc'
    @username, @password = Netrc.read[URI.parse(url).host]
  end
  if @username && @password
    self.class.basic_auth(@username, @password)
  end
end

Instance Method Details

#set_auth_type(auth_type) ⇒ Object



38
39
40
# File 'lib/gerry/client.rb', line 38

def set_auth_type(auth_type)
  warn 'set_auth_type is deprecated. digest auth is no longer supported'
end