Module: SingleUserOauth::Header

Extended by:
Header
Included in:
Header
Defined in:
lib/single_user_oauth/header.rb

Constant Summary collapse

UNWANTED_HEADER_KEYS =
[:request_method, :requested_url]

Instance Method Summary collapse

Instance Method Details

#create(keys) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/single_user_oauth/header.rb', line 8

def create(keys)
  @keys = keys
  key_length = required_keys.length - 1

  required_keys.each_with_index.with_object("OAuth ") do |((key,value), index), obj|
    obj << url_encode(key)
    obj << "="
    obj << "\""
    obj << url_encode(value)
    obj << "\""
    unless index == key_length
      obj << ","
      obj << " "
    end
  end
end