What is the proper “Rails Way” to consume a RESTful web service on another domain?

前端 未结 5 1605
感动是毒
感动是毒 2020-12-12 11:19

I would like to write a Ruby on Rails application that consumes a RESTful web service API performs some logic on the result and then displays that data on my view. For exam

5条回答
  •  再見小時候
    2020-12-12 11:33

    Restclient is a really nice solution to this problem.

    require 'rest_client'
    RestClient.get 'http://example.com/resource'
    RestClient.get 'http://example.com/resource', {:params => {:id => 50, 'foo' => 'bar'}}
    

    From the readme.

提交回复
热议问题