Create new Category with permissions through discourse api gem

Hi team.
Could you help me with my issue?
Namely I use discourse_api gem in my Rails project.
I would like to create according to my workflow:

  1. New group
  2. New category with permission for new created group (step 1)
  3. Create user in certain group

With creating group and users there are no problem while during creating category with permissions for my group appear a problem {“errors”=>[“unknown group”]}.

I follow next api calls

DISCOURSE_HOST = 'http://localhost:3001/'
api_key = 'someapikey'
api_username = 'someapiusername'
client = DiscourseApi::Client.new(DISCOURSE_HOST, api_key, api_username)

client.create_group(name: 'group_name', full_name: 'full_name')

“As documentation says :permissions is a hash with the group name and permission_type which is an integer 1 = Full 2 = Create Post 3 = Read Only”

client.create_category(name: name, description: description, color: '0088CC', text_color: 'FFFFFF', permissions: {group_name: 'group_name', permission_type: 1})

After this step I got {"errors"=>["unknown group"]}.

So something goes wrong. Maybe I pass wrong variables or maybe I should use another flow?

Could you advise some actions?

P.S. Creating category without permissions hash it successfully created