Class: Zas::HttpBasicCredentials

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

Overview

Credentials as taken from HTTP Basic Authentication.

Instance Method Summary collapse

Constructor Details

#initialize(base64_encoded_credentials) ⇒ HttpBasicCredentials

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



6
7
8
# File 'lib/zas/http_basic_credentials.rb', line 6

def initialize(base64_encoded_credentials)
  self.base64_encoded_credentials = base64_encoded_credentials
end

Instance Method Details

#to_wireObject

Construct a wire representation of the credentials.

Returns the encoded JSON



13
14
15
# File 'lib/zas/http_basic_credentials.rb', line 13

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