Here's a series of three new examples, building up from one another, showing the reading of a JSON feed from a remote web site in Ruby, and the analysis and presentation of that data.
The first example - [here]
- shows the loading of extra modules to handle reading from the web and the JSON format, and the use of the methods loaded fro those modules. Keycode is:
source = URI.parse("http://www.wellho.net/services/_.json")
fh = source.open
stuff = fh.read
things = JSON.parse(stuff)
and the example goes on to define and call methods to descend into the resultant object and display it.
The second example - [here]
- extends that initial example by providing an insetting class
to give a flexibility of display.
And the third example - [here]
- implements a second insetting class which outputs the structures loaded from JSON in the form of Ruby source code assignment statements or as a tree depending on a command line option. So the results will look like
WomanWithCat:kingston grahamellis$ ./tj3.rb -c | head
timedat = '1433231853'
lookfor = ''
when = '0'
where = '106.186.17.xx'
which = '/mouth/1114_PHP-Image-upload-script.html'
when = '0'
where = '194.187.171.xx'
WomanWithCat:kingston grahamellis$ ./tj3.rb s_name | head
s_name['timedat'] = '1433231872'
s_name['lookfor'] = ''
s_name['acc']['when'] = '1'
s_name['acc']['where'] = '94.197.121.xx'
s_name['acc']['which'] = '/pix/crpavatar.jpg'
s_name['acc']['when'] = '3'
s_name['acc']['where'] = '94.197.121.xx'
The source code for these examples is available through the links above, and the code is modestly commented - if you feel that you need to learn more about how it's done, please take a look at our Ruby Training courses
, or if you have a group of delegate please enquire about a tailored course at your offices or at our training centre. There are plenty of other examples to help you learn Ruby on our site - see [here]
for a complete module list - but there's nothing like having a tutor explain things to you and help you through the initial concepts to get you started! (written 2015-06-01, updated 2015-06-02)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articlesR114 - Ruby on the Web 
Web and console - same principle, same code - Ruby example - (2013-02-14) 
Ruby on the web - a simple example using CGI - (2012-06-22) 
Some TestWise examples - helping use Ruby code to check your web site operation - (2012-02-24) 
3 digit HTTP status codes - what are they, which are most common, which should be a concern? - (2011-09-11) 
Ruby at both extremes of your website - (2011-09-10) 
Answers on Ruby on Rails - (2010-01-30) 
Ruby on Rails - a sample application to teach you how - (2010-01-30) 
Ruby to access web services - (2008-11-16)R105 - Ruby - Classes and Objects 
Clear, concise examples - Ruby classes and objects. - (2013-02-17) 
Ruby off the Rails? - (2011-09-06) 
Calculation within objects - early, last minute, or cached? - (2010-02-26) 
Defining a static method - Java, Python and Ruby - (2010-02-01) 
Scope of variables - important to Ruby on Rails - (2010-01-31) 
Ruby objects - a primer - (2010-01-29) 
Object Orientation in Ruby - intermediate examples - (2009-07-16) 
Introduction to Object Oriented Programming - (2008-12-06) 
Blessing in Perl / Member variable in Ruby - (2006-12-14)R113 - Ruby - Further Input and Output 
Expect with Ruby - a training example to get you started - (2016-05-18) 
Running shell (operating system) commands from within Ruby - (2016-05-18) 
RUby - loading, using, changing, storing JSON format data - (2015-10-23) 
Reading and checking user inputs - first lessons - Ruby - (2013-02-17)R110 - Ruby - Special Variables and Pseudo-Variables 
One line scripts - Awk, Perl and Ruby - (2016-05-20) 
Ruby - a teaching example showing many of the language features in short but useful program - (2012-06-09) 
Object Oriented Ruby - new examples - (2010-02-03) 
Constants in Ruby - (2010-02-01) 
Variable scope - what is it, and how does it Ruby? - (2009-07-18) 
Some Ruby programming examples from our course - (2008-03-21) 
Variable types in Ruby - (2008-03-21) 
Ruby - Totally Topical - (2006-12-16)R107 - Collections (Arrays and Hashes) in Ruby 
Significant work - beyond helloworld in Ruby - (2015-05-27) 
Shuffling a list - Ruby and Python - (2014-12-28) 
Sorta sorting a hash, and what if an exception is NOT thrown - Ruby - (2011-09-12) 
All possible combinations from a list (Python) or array (Ruby) - (2011-04-23) 
Process every member of an array, and sort an array - Ruby - (2011-04-21) 
Is this number between? Does this list include? - Ruby - (2011-04-18) 
Creating, extending, traversing and combining Ruby arrays - (2010-09-30) 
Ruby collections and strings - some new examples - (2010-02-03) 
What are Ruby Symbols? - (2010-02-02) 
Sorting arrays and hashes in Ruby - (2010-01-30) 
Collection objects (array and hash) in Ruby - (2009-07-16) 
Adding a member to a Hash in Ruby - (2006-12-16)
Some other Articles
Peak weekend - where there are still rooms near MelkshamRegular Expressions for the petrified - in RubyWhere does Ruby load modules from, and how to load from current directorySeparating your code for easier testing, understanding and re-use; example in RubyReading and parsing a JSON object in RubyDefining the behaviour of your web site and testing that it worksThe TransWilts Community Intergrated Transport CorridorRuby - where one statement ends and the next beginsAround the world from Melksham