"Unknow function 'foreman'"

Hi, I have tried to use Foreman API for pull some data from foreman's
database.
I write test_module and integrate it into Foreman:

class enc {

$hosts = foreman("hostgroup=devops", "state=all")

file {'/tmp/test.conf':
ensure => present,
content => template('enc/test.erb'),
}

}

When I try to do puppet agent -t one test node this error has occur:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER:
Server Error: Evaluation Error: Error while evaluating a Resource
Statement, Evaluation Error: Unknown function: 'foreman'. at
/etc/puppetlabs/code/environments/production/modules/enc/manifests/init.pp:3:12
on node centos-25

I have foreman.rb there:
/usr/share/foreman-installer/modules/foreman/lib/puppet/parser/functions/foreman.rb

What's wrong?