I’m trying to do a POST request from a ruby app and I’m getting the following error.
Here is the code:
def action_reply(token,action_id,reply_text)
require 'uri'
require 'net/http'
require 'net/https'
@reply = { 'ACTION_ID' => action_id, 'text' => reply_text }.to_json
#A token is required to do this post
@token_url = 'https://example.com/reply?oauth_token=' + token
uri = URI.parse(@token_url)
response = Net::HTTP.post_form(uri,@reply)
end
I’m getting an error in the last step that says:
NoMethodError (undefined method `map' for #<String:0x000000063798e8>)
Any idea why this is?
Thanks!
Because you’re passing a string to a method expecting a hash: remove the
to_jsoncall.Unrelated, but is it necessary to have those instance variables be instance variables?