I am running rails 4 with the rbing gem installed (version 1.1.0)

require 'rbing'
bing = RBing.new("YOURAPPID")

rsp = bing.web("ruby", :site => "github.com")
puts rsp.web.results[0].url

Just like the example here: https://github.com/mikedemers/rbing

when I run it I get this error:

undefined method `web' for # RBing::ResponseData:0x007f42500bb190

有帮助吗?

解决方案

I ended up using google instead

client = Google::APIClient.new(:authorization => nil)

google_search = client.discovered_api('customsearch', 'v1')

google_result = client.execute(
        :api_method => google_search.cse.list,
        :authenticated => false,
        :parameters => {
          'q' => query,
          'key' => key, # your key received from google
          'siteSearch' => query_params[1],
          'cx' => cx, # your cx code received from google
          'num' => 1
        }
      )
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top