searchbing 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/bing.rb +27 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZGZhZmU2MDk2ZTA1OWMwMmM3MjgzNThiOTA2MzlhYjhlNGE0OTQyNQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTg3YWUxYmNlOWFhNjBjYTY2ZWQ4Nzg1YjBjY2I2ZDc2NGVlMmI1Yg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGRjOWIxZjQxM2ViZmI1MTcyMzk0OTIwYTQ3ZGU2NTc0YTI1ZjNlMTVhZmNm
|
10
|
+
ZGY5YWI1YmM3OGY0MDAxNjJkODFkOGVkMzg0NjEwNzkxZmE1NjJjZTA4YTc4
|
11
|
+
NzI5NTdhNjdjZTJhOWNlNTViMDRjMDFmZTc2NGMwOTI0MTRmOGE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODc5NjEwMzNlNWQ1YWE0MDNhMjA1YzU5N2UyNjQ4Nzk1OTY3ZmU0MGQzMjY3
|
14
|
+
NGY0N2U4ZGVhNWFhYzRjZGFiNzI1ZWQ5MGNhMjBkNzliZmMyNDMxYmZhOGYz
|
15
|
+
NTM4Mzg3NmQ2NjI1NjVkYzUwMjZjYmU3Y2NmZTM4YzI3NzVhYzI=
|
data/lib/bing.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
class Bing
|
2
|
+
def initialize(accountKey, num_results, type)
|
3
|
+
@accountKey = accountKey
|
4
|
+
@num_results = num_results
|
5
|
+
@type = type
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_accessor :accountKey, :num_results, :type
|
9
|
+
|
10
|
+
def search(search_term)
|
11
|
+
user = ''
|
12
|
+
web_search_url = "https://api.datamarket.azure.com/Bing/Search/#{type}?$format=json&Query="
|
13
|
+
deuxieme = URI.encode_www_form_component('\'' + search_term + '\'')
|
14
|
+
specs = "&$top=#{@num_results}"
|
15
|
+
youknow = web_search_url + deuxieme + specs
|
16
|
+
|
17
|
+
uri = URI(youknow)
|
18
|
+
req = Net::HTTP::Get.new(uri.request_uri)
|
19
|
+
req.basic_auth user, accountKey
|
20
|
+
|
21
|
+
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https'){|http|
|
22
|
+
http.request(req)
|
23
|
+
}
|
24
|
+
|
25
|
+
res.body
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: searchbing
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rob Culliton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-11 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: simply create a new instance of the Bing class, with your account key,
|
14
|
+
number of results, and search type. Then call the search method on your new object
|
15
|
+
with a search term
|
16
|
+
email: rob.culliton@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- lib/bing.rb
|
22
|
+
homepage: https://github.com/rcullito
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.0.3
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: compatible with the recent azure migration,use bing's search api in your
|
46
|
+
ruby app with text, images, or video
|
47
|
+
test_files: []
|