searchbing 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/searchbing.rb +5 -3
  2. metadata +1 -1
data/lib/searchbing.rb CHANGED
@@ -34,10 +34,12 @@ class Bing
34
34
  def search(search_term, offset = 0)
35
35
 
36
36
  user = ''
37
- web_search_url = "https://api.datamarket.azure.com/Bing/Search/#{type}?$format=json&Query="
37
+ web_search_url = "https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources="
38
+ sources_portion = URI.encode_www_form_component('\'' + @type + '\'')
39
+ query_string = '&$format=json&Query='
38
40
  query_portion = URI.encode_www_form_component('\'' + search_term + '\'')
39
41
  params = "&$top=#{@num_results}&$skip=#{offset}"
40
- full_address = web_search_url + query_portion + params
42
+ full_address = web_search_url + sources_portion + query_string + query_portion + params
41
43
 
42
44
  uri = URI(full_address)
43
45
  req = Net::HTTP::Get.new(uri.request_uri)
@@ -50,4 +52,4 @@ class Bing
50
52
  body = JSON.parse(res.body)
51
53
  result_set = body["d"]["results"]
52
54
  end
53
- end
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchbing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: