"Unknow function 'foreman'"

Hi, I have tried to use Foreman API for pull some data from foreman's
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
on node centos-25

I have foreman.rb there:

What's wrong?