module Harvest
  module API
    
    # API Methods to contain all account actions
    class Account < Base
      
      # Returns the current rate limit information
      # @return [Harvest::RateLimitStatus]
      def rate_limit_status
        response = request(:get, credentials, '/account/rate_limit_status')
        Harvest::RateLimitStatus.parse(response.body).first
      end
      
      # Returns the current logged in user
      # @return [Harvest::User]
      def who_am_i
        response = request(:get, credentials, '/account/who_am_i')
        Harvest::User.parse(response.body).first
      end
    end
  end
end
module Harvest
  module API
    
    # API Methods to contain all account actions
    class Account < Base
      
      # Returns the current rate limit information
      # @return [Harvest::RateLimitStatus]
      def rate_limit_status
        response = request(:get, credentials, '/account/rate_limit_status')
        Harvest::RateLimitStatus.parse(response.body).first
      end
      
      # Returns the current logged in user
      # @return [Harvest::User]
      def who_am_i
        response = request(:get, credentials, '/account/who_am_i')
        parsed = JSON.parse(response.body)
        Harvest::User.parse(parsed).first.tap do |user|
          user.company = parsed["company"]
        end
      end
    end
  end
end

Stop throwing away company info
Stop throwing away company info

Company information is returned as a top-level key in the response to `/account/who_am_i`. By feeding that response directly into `Harvest::User.parse`, we throw away that data. This change preserves that data and makes it accessible by simply tacking it on to the returned user object as the `company` attribute.