searchbing 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -10
- data/lib/searchbing.rb +2 -2
- metadata +6 -4
- checksums.yaml +0 -15
data/README.md
CHANGED
@@ -26,21 +26,17 @@ Example: Interactive Ruby Shell
|
|
26
26
|
require the gem in your shell session
|
27
27
|
|
28
28
|
require 'searchbing'
|
29
|
-
create a new search object
|
29
|
+
create a new search object, here 10 is the number of results. you can retrieve up to 50 at a time
|
30
30
|
|
31
31
|
bing_image = Bing.new('your_account_key_goes_here', 10, 'Image')
|
32
32
|
retrieve the results for a given term
|
33
33
|
|
34
34
|
bing_results = bing_image.search("puffin")
|
35
|
-
parse the results
|
36
|
-
|
37
|
-
puts bing_results[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
35
|
|
36
|
+
or optionally specify an offset for your search, to start retrieving results from the starting point provided
|
45
37
|
|
38
|
+
bing_results = bing_image.search("puffin", 25)
|
46
39
|
|
40
|
+
parse the results
|
41
|
+
|
42
|
+
puts bing_results[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail
|
data/lib/searchbing.rb
CHANGED
@@ -30,12 +30,12 @@ class Bing
|
|
30
30
|
# Arguments:
|
31
31
|
# search_term: (String)
|
32
32
|
|
33
|
-
def search(search_term)
|
33
|
+
def search(search_term, offset = 0)
|
34
34
|
|
35
35
|
user = ''
|
36
36
|
web_search_url = "https://api.datamarket.azure.com/Bing/Search/#{type}?$format=json&Query="
|
37
37
|
query_portion = URI.encode_www_form_component('\'' + search_term + '\'')
|
38
|
-
params = "&$top=#{@num_results}"
|
38
|
+
params = "&$top=#{@num_results}&$skip=#{offset}"
|
39
39
|
full_address = web_search_url + query_portion + params
|
40
40
|
|
41
41
|
uri = URI(full_address)
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchbing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Rob Culliton
|
@@ -22,26 +23,27 @@ files:
|
|
22
23
|
homepage: https://github.com/rcullito
|
23
24
|
licenses:
|
24
25
|
- 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
|
31
32
|
requirements:
|
32
33
|
- - ! '>='
|
33
34
|
- !ruby/object:Gem::Version
|
34
35
|
version: '0'
|
35
36
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
36
38
|
requirements:
|
37
39
|
- - ! '>='
|
38
40
|
- !ruby/object:Gem::Version
|
39
41
|
version: '0'
|
40
42
|
requirements: []
|
41
43
|
rubyforge_project:
|
42
|
-
rubygems_version:
|
44
|
+
rubygems_version: 1.8.24
|
43
45
|
signing_key:
|
44
|
-
specification_version:
|
46
|
+
specification_version: 3
|
45
47
|
summary: compatible with the recent azure migration,use bing's search api in your
|
46
48
|
ruby app with text, images, or video
|
47
49
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
NzZhZjBlNGQwNmRkZWM0NTIyZDdiMGRmMGVlNjYyZDBiZTAzZjZiZA==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
Yjg0ZDdjNTI0ODcyYjljYmNkY2JkMzc3NjBjMTlmMDNhYjJkZTg5OQ==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
NjQ4YTg2ZjFmNGY2NTcyOWJkYmU2Y2JhNmZiMTUyMjA0YjVmNjI2OTBmM2Q4
|
10
|
-
MWRiNGE4YWY0YTg2NTVmMDYyNjM4OGM3ZDQ5YWIzNzg4ODQ5MTI2ZjZlYTUw
|
11
|
-
NjY1YTEzYzdlMjU1MzQ2Y2QzZjkwOGJkZDkxYjBmZTMzMTQzZDk=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZGNjZjVmNTBmMzYxMzMyMTQ5N2FmOGExYTY3ZDk2NDc2OWNhYjJmMDJmYTkz
|
14
|
-
OGFiYjFkZDg2YzVhNzExZDc0NWIzMWJiODkxOTNkYzNhZDM0ZDJkOWJmMTI5
|
15
|
-
MjJkOTI1MmE5NjFkYmJjYjIwNTMzZDlhYzU2ZTg4MDhhYjQyYmQ=
|