Class: AFHTTPRequestSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/afmotion/serializer.rb

Defined Under Namespace

Classes: HeaderWrapper

Instance Method Summary collapse

Instance Method Details

#authorization=(options = {}) ⇒ Object

options can be

  • _, password: __

or

  • {token: _ }



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/afmotion/serializer.rb', line 30

def authorization=(options = {})
  if options.nil?
    clearAuthorizationHeader
  elsif options[:username] && options[:password]
    setAuthorizationHeaderFieldWithUsername(options[:username], password: options[:password])
  elsif options[:token]
    setAuthorizationHeaderFieldWithToken(options[:token])
  else
    raise "Not a valid authorization hash: #{options.inspect}"
  end
end

#headersObject



22
23
24
# File 'lib/afmotion/serializer.rb', line 22

def headers
  @header_wrapper ||= HeaderWrapper.new(self)
end