HTTParty and authorization via token
Managed to get it working as follows.
HTTParty.get("http://localhost:3020/api/products", headers: {"Authorization" => "Token token=\"111\""})
This also works if you want to set headers of the class dynamically, this example is for obtaining the Authorization token for Dun and Bradstreet
require 'httparty'require 'certified'class DnbAuth include HTTParty debug_output $stdout base_uri "https://maxcvservices.dnb.com/rest/Authentication" def initialize(ct,u,p) self.class.headers 'Content-type' => "#{ct}" self.class.headers 'x-dnb-user' => "#{u}" self.class.headers 'x-dnb-pwd'=> "#{p}" end def token() response = self.class.post("/") endendct = 'text/xml'u = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'p = 'xxxxxx'xx = DnbAuth.new(ct,u,p)puts xx.token.message