Reputation: 689
I did follow their documentation on https://googleapis.dev/ruby/google-cloud-recaptcha_enterprise-v1/latest/index.html
I first added the env variable RECAPTCHA_ENTERPRISE_CREDENTIALS
then run the
client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
documentation says response = client.create_assessment request
but documentation didn't add sample request so I did assume that it will look like in this documentation https://cloud.google.com/recaptcha-enterprise/docs/create-assessment
{
"event": {
"token": "token",
"siteKey": "key"
}
}
But when I execute the client.create_assessment
it is giving me error ArgumentError: Unknown field name 'event' in initialization map entry.
I also tried to follow this https://googleapis.dev/ruby/google-cloud-recaptcha_enterprise-v1/latest/Google/Cloud/RecaptchaEnterprise/V1/RecaptchaEnterpriseService/Client.html#create_assessment-instance_method
where the parameters is request and also gives me error ArgumentError: Unknown field name 'request' in initialization map entry.
What could be the correct parameter/request for creating assessment?
Gem I used is google-cloud-recaptcha_enterprise-v1
and google-cloud-recaptcha_enterprise
Upvotes: 0
Views: 2369
Reputation: 689
So I solve this issue by using client.create_assessment(parent: "projects/{your project-id}", assessment: event)
my event value was event = Google::Cloud::RecaptchaEnterprise::V1::Event.new(token: "token from execute", site_key: "your site key")
It solves the error and answers the question (but another error after this one occurred about permission denied). I Will update once resolved.
Upvotes: 1