作者:疯子zls_565 | 来源:互联网 | 2023-09-02 14:42
我正在使用一个API,该API可让我检查用户是否已连接到任何帐户(Amazon,Ebay,Prestashop等)。
建立连接后,我在JSON
中收到一个类似以下内容的网钩:
Parameters: {"connection"=>{"informations"=>{},"connector_uuid"=>"3180ba23-2b75-5abe-b14d-69a42835474d","id_user"=>626,"created"=>"2019-12-26 10:03:41","id_provider"=>940,"error_message"=>nil,"last_push"=>nil,"last_update"=>"2019-12-26 10:03:45","connector"=>{"sync_frequency"=>nil,"code"=>nil,"uuid"=>"3180ba23-2b75-5abe-b14d-69a42835474d","documents_type"=>["bill"],"color"=>"c8ee20","auth_mechanism"=>"credentials","capabilities"=>["document"],"id"=>470,"available_auth_mechanisms"=>["credentials"],"beta"=>true,"months_to_fetch"=>nil,"urls"=>["https://addons.prestashop.com"],"siret"=>nil,"hidden"=>false,"charged"=>true,"slug"=>"PRE","categories"=>[],"name"=>"PrestaShop"},"active"=>true,"state"=>nil,"expire"=>nil,"accounts"=>[],"error"=>nil,"subscriptions"=>[{"id_source"=>604,"documents"=>[],"id_user"=>696,"deleted"=>nil,"id_connection"=>708,"number"=>"test01@gmail.com","validity"=>nil,"label"=>"test@gmail.com","subscriber"=>"John Doe","currency"=>nil,"disabled"=>nil,"error"=>"bug","id"=>550,"formatted_balance"=>nil,"renewdate"=>nil,"balance"=>nil,"last_update"=>nil}],"next_try"=>"2019-12-27 14:03:45","id_connector"=>440,"id"=>608},"push_type"=>"partial_history","user"=>{"signin"=>"2019-12-26 10:03:08","platform"=>"sharedaccess","id"=>626},"invoice"=>{"connection"=>{"informations"=>{},"id_user"=>926,"id_provider"=>480,"id"=>440,"subscriptions"=>[{"id_source"=>699,"id_connection"=>608,"label"=>"compere01@gmail.com","id_connector"=>490,"id"=>908},"id"=>626}}}
您知道如何在我的视图中显示此JSON
吗?
我在控制器中尝试过:
def webhooks
render json: response.body,status: 200
puts response.body.inspect
end
但是在我看来没有任何反应,我在控制台中有JSON,但我的put呈现了一个空字符串。
参数 ,而不是 response.body
def webhooks
render json: params,status: 200
puts params
end