Class: Zas::HttpBasicCredentials

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

Overview

Public: Credentials as taken from HTTP Basic Authentication.

Instance Method Summary collapse

Constructor Details

#initialize(base64_encoded_credentials) ⇒ HttpBasicCredentials

Public: Construct the credentials with the base64 encoded value passed directly from an HTTP request.

base64_encoded_credentials - The Base64 encoded HTTP Basic credentials



8
9
10
# File 'lib/zas/http_basic_credentials.rb', line 8

def initialize(base64_encoded_credentials)
  self.base64_encoded_credentials = base64_encoded_credentials
end

Instance Method Details

#to_wireObject

Public: Construct a wire representation of the credentials.

Returns the encoded JSON



15
16
17
# File 'lib/zas/http_basic_credentials.rb', line 15

def to_wire
  Yajl::Encoder.encode({:strategy => :http_basic_auth, :credentials => base64_encoded_credentials})
end