Can't run ruby scripts on Cloud9

ruby

#1

I installed all the required gems in the command line and then I ran the script. I always get “rubyscraper.rb:8:in <main>': undefined local variable or methodhttparty’ for main:Object (NameError)” for all of the methods. WTF???

require 'httparty’
require 'nokogiri’
require 'pry’
require 'JSON’
require ‘csv’

page = httparty.get(‘https://google.com’)
puts page.response.body
puts 1+1


#2

Per httparty's documentation, you need to refer to it as HTTParty in your code, so:

page = httparty.get('https://google.com')

Should become:

page = HTTParty.get('https://google.com')

#3

The issue looked like Cloud9 was not loading the correct library path of the installed gems. I created a new workspace and created a new folder/directory to install the gems to get it working.