Class: CabbageDoc::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/cabbage_doc/client.rb

Defined Under Namespace

Classes: CustomParser

Class Method Summary collapse

Class Method Details

.new(auth) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cabbage_doc/client.rb', line 15

def new(auth)
  Class.new(self) do |klass|
    klass.headers "User-Agent" => auth.user_agent
    klass.base_uri auth.uri

    if auth.type == :basic
      klass.basic_auth auth.username, auth.password
    elsif auth.token
      klass.headers "Authorization" => "#{auth.type.to_s.capitalize} #{auth.token}"
    end

    debug_output $stdout if auth.verbose
  end
end