Class: Io::Flow::Reference::V0::HttpClient::Authorization

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme, username, opts = {}) ⇒ Authorization

Returns a new instance of Authorization.



1016
1017
1018
1019
1020
1021
# File 'lib/io_flow_reference_v0.rb', line 1016

def initialize(scheme, username, opts={})
  @scheme = HttpClient::Preconditions.assert_class('schema', scheme, AuthScheme)
  @username = HttpClient::Preconditions.check_not_blank('username', username, "username is required")
  @password = HttpClient::Preconditions.assert_class_or_nil('password', opts.delete(:password), String)
  HttpClient::Preconditions.assert_empty_opts(opts)
end

Instance Attribute Details

#passwordObject (readonly)

Returns the value of attribute password.



1014
1015
1016
# File 'lib/io_flow_reference_v0.rb', line 1014

def password
  @password
end

#schemeObject (readonly)

Returns the value of attribute scheme.



1014
1015
1016
# File 'lib/io_flow_reference_v0.rb', line 1014

def scheme
  @scheme
end

#usernameObject (readonly)

Returns the value of attribute username.



1014
1015
1016
# File 'lib/io_flow_reference_v0.rb', line 1014

def username
  @username
end

Class Method Details

.basic(username, password = nil) ⇒ Object



1023
1024
1025
# File 'lib/io_flow_reference_v0.rb', line 1023

def Authorization.basic(username, password=nil)
  Authorization.new(AuthScheme::BASIC, username, :password => password)
end