Seems to me it can be a predicate (verb), direct object, or indirect object. You can write a sentence with it in any of those places.
Verb . . . I hug you.
Direct object . . . I gave you a hug.
Indirect object . . . You recoiled at the aggressiveness of the hug.
'Hug' is a direct object in a sentence when it receives the action of the verb, as in 'I gave him a hug.' It cannot function as an indirect object by itself since indirect objects always accompany direct objects. The key is understanding the relationship of the noun to the verb in the sentence.
;