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

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.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.



55587
55588
55589
55590
55591
55592
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55587

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.



55585
55586
55587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55585

def password
  @password
end

#schemeObject (readonly)

Returns the value of attribute scheme.



55585
55586
55587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55585

def scheme
  @scheme
end

#usernameObject (readonly)

Returns the value of attribute username.



55585
55586
55587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55585

def username
  @username
end

Class Method Details

.basic(username, password = nil) ⇒ Object



55594
55595
55596
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 55594

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