Outputting JSON on webpage

I have been given a task to output json on web page using Ruby and/or
Rails. I would like to use both. I have to consume json from endpoint
and have been given a URL link to it. It should be served up on a web
server. I think I have an understanding of how to do it. I will use
rails api gem.

Can someone please tell me if this is the right way? any recommendation
as or advice as is the first time I am using JSON and RoR together.

I also have to use testing I will use BDD or TDD using capybara and
rspec.

What task is precisely? You need just to proxy json data from other
service?

On Tue, May 12, 2015 at 3:27 PM, Mohammed R. [email protected]

Yes that is exactly what I need to do. I have been given a link which
has json data. It must be outputted to ruby web page.

Well, you can do simply this:

require ‘open-uri’

class MyController
def show
content = open(URL_TO_FETCH_FROM).read
render text: content
end
end

Primitive solution

On Tue, May 12, 2015 at 4:03 PM, Mohammed R. [email protected]