1

I chose "factual-api" gem after looking at the factual website. May I know how do I set it up and use the function to get the locations of those areas? Can I write it in the controller/model?

After trying to install the gem, I get this when I look at my gemfile:

Gem "factual-api" is unavailable in SDK 'RVM: ruby-1.9.2-p290

This inspection warns about unavailable gems inside the current SDK. The IDE needs the gems to provide come completion, navigation and analysis. An appropriate quick-fix is available to install the required gems.

When I run the command bundle install, I do not have any errors. But when I called:

factual = Factual.new("YOUR_KEY", "YOUR_SECRET")

I get this:

NameError: uninitialized constant Factual

What am I doing wrong now? What should be the right way to do so?

amalloy
  • 89,153
  • 8
  • 140
  • 205
Edwin
  • 55
  • 1
  • 7
  • take a look at https://github.com/Factual/factual-ruby-driver – peter Aug 27 '12 at 07:38
  • yes, i saw that just now. But i do not know how to use something like this 'factual.table("places").filters("name" => {"$bw" => "starbucks"}).rows'. I don't know how should i put it in the controller/model. Its seems like javascript variable to me. *i am still learning how to write ruby* – Edwin Aug 27 '12 at 08:47
  • you'd better publish what you tried so far accompagnied with the error with offending linenumber, seems you didn't correctly install or include the GEM, also install the most recent version of Ruby – peter Aug 27 '12 at 10:18
  • can u paste some code, what u have tried till now.. – Bijendra Aug 27 '12 at 11:01

1 Answers1

2

This answer is a bit late, but I'm posting it anyway so it can be marked as answered.

As mentioned in the comments the recommended approach is to use Factual's Ruby Driver which can be found at http://github.com/Factual/factual-ruby-driver or installed with the following in your Gemfile:

gem 'factual-api', :require => 'factual'

If not using a Gemfile remember to manually require 'factual' somewhere. I also like to put an initializer in the config folder with the OAuth details if it's a private repository that looks something like this:

class Factual
  KEY = 'YOUR-OAUTH-KEY'
  SECRET = 'YOUR-OAUTH-SECRET'
end

This allows you to access the Factual API anywhere in your app with

factual = Factual.new Factual::KEY, Factual::SECRET