Advertisement
Guest User

Untitled

a guest
May 10th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def add_auth_details_to_options(args)
  2. if @auth_details
  3. options = {}
  4. if args.size > 1
  5. options = args[1]
  6. end
  7. if @auth_details.has_key? :access_token
  8. options[:headers] = {
  9. "Authorization" => "Bearer #{@auth_details[:access_token]}" }
  10. elsif @auth_details.has_key? :api_key
  11. if not options.has_key? :basic_auth
  12. options[:basic_auth] = {
  13. :username => @auth_details[:api_key], :password => 'x' }
  14. end
  15. end
  16. args[1] = options
  17. end
  18. args
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement