Class: Castle::ClientId::Extract

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/client_id/extract.rb

Overview

used for extraction of cookies and headers from the request

Instance Method Summary collapse

Constructor Details

#initialize(headers, cookies) ⇒ Extract

Returns a new instance of Extract.

Parameters:

  • headers (Hash)
  • cookies (NilClass|Hash)


9
10
11
12
# File 'lib/castle/client_id/extract.rb', line 9

def initialize(headers, cookies)
  @headers = headers
  @cookies = cookies || {}
end

Instance Method Details

#callString

extracts client id

Returns:

  • (String)


16
17
18
# File 'lib/castle/client_id/extract.rb', line 16

def call
  @headers['X-Castle-Client-Id'] || @cookies['__cid'] || ''
end