title: Reading x-access-Level header for Twitter REST API using omniauth-twitter / twitter Gem
body: <p>I'm using Omniauth to authenticate users with Twitter through OAuth (using <code>omniauth-twitter</code> gem). I plan to allow normal users to login with just 'read' permissions, and only authorise 'read-write' permissions if/when they decide to create things within the site.</p>
  
  <p>In my <code>Identity</code> model I'm analysing the <code>AuthHash</code> omniauth passes to the create_with_omniauth action, and I'm making separate logic for each provider type, so that I can look deeper into the returned hash schema if necessary.</p>
  
  <p>If I <code>raise auth.to_yaml</code> to output the structure, I see the 'x-access-level' header that I'd like to read, but I don't know how to look into the <code>response: Net::HTTPOK</code> object in order to get to the next level of the structure.</p>
  
  <p>This is the auth structure, <em>cutting out some of the unnecessary details</em></p>
  
  <pre><code>--- !ruby/hash:OmniAuth::AuthHash
  provider: twitter
  ...
  extra: !ruby/hash:Hashie::Mash
    ...
    access_token: !ruby/object:OAuth::AccessToken
      ...
      response: !ruby/object:Net::HTTPOK
        http_version: '1.1'
        code: '200'
        message: OK
        header:
          x-access-level:
          - read-write
          x-ratelimit-limit:
          - '350'
          x-ratelimit-remaining:
          - '348'
          x-ratelimit-reset:
          - '1330798604'
  </code></pre>
  
  <p>So far I can get to the response with <code>auth["extra"]["access_token"].response</code> but putting <code>.header</code> at the end returns the same response structure, and <code>["header"]</code> is empty when I raise it.</p>
  
  <p>I'm ok with using the Twitter gem if necessary to do a <code>verify_credentials</code> call inside the Identity model (since Twitter adds the x-access-level header to every response, but even with this approach I wouldn't know how to read the returned headers to read the x-access-level header.</p>