load_default_client

in lib/twurl/oauth_client.rb [85:104]


      def load_default_client(options)
        return if options.command == 'bearer_tokens'

        exception_message = "You must authorize first."
        app_only_exception_message = "To use --bearer option, you need to authorize (OAuth1.0a) and create at least one user profile (~/.twurlrc):\n\n" \
                                     "twurl authorize -c key -s secret\n" \
                                     "\nor, you can specify issued token's consumer_key directly:\n" \
                                     "(to see your issued tokens: 'twurl bearer_tokens')\n\n" \
                                     "twurl --bearer -c key '/path/to/api'"

        raise Exception, "#{options.app_only ? app_only_exception_message : exception_message}" unless rcfile.default_profile
        if options.app_only
            raise Exception, "No available bearer token found for consumer_key:#{rcfile.default_profile_consumer_key}" \
              unless rcfile.has_bearer_token_for_consumer_key?(rcfile.default_profile_consumer_key)
            load_client_for_app_only_auth(options, rcfile.default_profile_consumer_key)
        else
          load_client_for_username_and_consumer_key(*rcfile.default_profile)
        end
      end