searchbing 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +5 -4
  3. data/lib/searchbing.rb +8 -3
  4. metadata +5 -7
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2YwY2YyYjQ4YzljNThmNmExZDJhMzA0MmU5NTU2MmNmNWVjMjk2MQ==
5
+ data.tar.gz: !binary |-
6
+ MmQ2ODRjNzYwMGZiZjFhNWNkNzdhNzU1Mjc3MmUzNWE3YWRlYTIwNQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDM2YTFjN2UyZWFhMWQ4NzY3NDYzMDU2ODc3ZWQwYTJlZjQzMmFiNjcxNWMz
10
+ Yzk1ZDJkYWEyYzA1MzllMjI1NmI5MjE2YWYxOWQxZTU0M2Y0ZmM2NzI3ZmVh
11
+ M2RjOTcwOWU3NGQzZjQ5ZjY4Y2Y4MjIzOTJlNTc3MTQ3NjM1MjE=
12
+ data.tar.gz: !binary |-
13
+ MWZkZDRmYTkyOTMwZTZjZDEzNzQ2ZmIwMDExZmQxMzVjNjBlNDlmNzUyY2Q0
14
+ NTRhZmNiYTA0YmIzZDA3YWZhZDgxMjZjMWEyMTUxNDE4YWMxZWM1MzhmMmQ1
15
+ ZWUzYzY1NmZiMDI5Y2RkMTY4YzVkZDhlNjRkNzY5MjBiNGViNGY=
data/README.md CHANGED
@@ -2,7 +2,7 @@ searchbing [![Build Status](https://travis-ci.org/rcullito/searchbing.png?branch
2
2
  =========
3
3
 
4
4
 
5
- ![Puffin](http://photos-g.ak.fbcdn.net/hphotos-ak-snc1/hs166.snc1/6216_704615592619_7804626_41719230_39698_n.jpg)
5
+ ![Puffin](http://static.guim.co.uk/sys-images/Environment/Pix/pictures/2008/07/29/puffin1.jpg)
6
6
 
7
7
 
8
8
  A gem for the Bing Search API 2.0.
@@ -17,11 +17,12 @@ find the [gem](https://rubygems.org/gems/searchbing) on rubygems.org
17
17
 
18
18
  Configuration
19
19
  -------------
20
- An account key is needed to use the Bing Search API. You can create a new account for the Bing Search API and obtain account key [here](http://www.bing.com/developers/)
20
+ A subscription and account key are needed to use the Bing Search API. You can create a new account for the Bing Search API and obtain account key [here](https://datamarket.azure.com/dataset/bing/search)
21
+ The WebOnly search requires a separate subscription found [here](https://datamarket.azure.com/dataset/bing/searchweb)
21
22
 
22
23
  ## Usage
23
24
 
24
- - valid search types include: Image, Web, News or Video. The first letter must be capitalized
25
+ - valid search types include: Image, Web, WebOnly, News or Video. The first letter must be capitalized
25
26
 
26
27
  - this gem relies on the open-uri, net/http, and json gems.
27
28
 
@@ -47,4 +48,4 @@ parse the results(recent changes require parsing with symbols, also please note
47
48
 
48
49
  display the total number of results
49
50
 
50
- puts bing_results[0]["ImageTotal"]
51
+ puts bing_results[0][:ImageTotal]
@@ -36,16 +36,21 @@ class Bing
36
36
  def search(search_term, offset = 0)
37
37
 
38
38
  user = ''
39
- web_search_url = "https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources="
40
39
  sources_portion = URI.encode_www_form_component('\'' + @type + '\'')
41
- query_string = '&$format=json&Query='
40
+ query_string = '$format=json&Query='
42
41
  query_portion = URI.encode_www_form_component('\'' + search_term + '\'')
43
42
  params = "&$top=#{@num_results}&$skip=#{offset}"
44
43
  @params.each do |k,v|
45
44
  params << "&#{k.to_s}=\'#{v.to_s}\'"
46
45
  end
46
+ if type=='WebOnly'
47
+ web_search_url = "https://api.datamarket.azure.com/Bing/SearchWeb/v1/Web?"
48
+ full_address = web_search_url + query_string + query_portion + params
49
+ else
50
+ web_search_url = "https://api.datamarket.azure.com/Bing/Search/v1/Composite?Sources="
51
+ full_address = web_search_url + sources_portion + '&' + query_string + query_portion + params
52
+ end
47
53
 
48
- full_address = web_search_url + sources_portion + query_string + query_portion + params
49
54
 
50
55
  uri = URI(full_address)
51
56
  req = Net::HTTP::Get.new(uri.request_uri)
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchbing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
5
- prerelease:
4
+ version: 0.2.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rob Culliton
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-11 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: bing search api gem compatible with recent microsoft azure migration.
15
14
  Find README.md with example usage at https://github.com/rcullito/searchbing
@@ -23,27 +22,26 @@ files:
23
22
  homepage: https://github.com/rcullito
24
23
  licenses:
25
24
  - MIT
25
+ metadata: {}
26
26
  post_install_message:
27
27
  rdoc_options: []
28
28
  require_paths:
29
29
  - lib
30
30
  required_ruby_version: !ruby/object:Gem::Requirement
31
- none: false
32
31
  requirements:
33
32
  - - ! '>='
34
33
  - !ruby/object:Gem::Version
35
34
  version: '0'
36
35
  required_rubygems_version: !ruby/object:Gem::Requirement
37
- none: false
38
36
  requirements:
39
37
  - - ! '>='
40
38
  - !ruby/object:Gem::Version
41
39
  version: '0'
42
40
  requirements: []
43
41
  rubyforge_project:
44
- rubygems_version: 1.8.23
42
+ rubygems_version: 2.4.3
45
43
  signing_key:
46
- specification_version: 3
44
+ specification_version: 4
47
45
  summary: compatible with the recent azure migration,use bing's search api in your
48
46
  ruby app with text, images, or video
49
47
  test_files: []