searchbing 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +2 -2
- data/lib/searchbing.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDUzZGNiOTQwYzAzYTQ5NjJmMWU3NGY2M2JiMDc1N2ZmYjBlMTU3ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZWRkMDE1NjY3YmM5MDMwZmQwMDJkOTVlNGY2OTUxMGY4ZTY3M2VkYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODFhM2ZjZDRlYTIzYjFjMmZjZjI2ZTVkMjU0N2UxMzk1MDVjOTE5ZGRhMGMy
|
10
|
+
YmRkZGIzM2I3NTgzZjkzYmU5MDFmMzk2YTU4NGI4MDM0ZjMwNTYyNDU0NTBm
|
11
|
+
MDM4M2Q1ZjliNjU4NmMzNDQ3OGQ0NzVjZDM3NjYzM2E1NjhiZGQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDdiYjkwNzE0ODYzNTZjZDI5NzY1MDM0ZTQyZjgwNjk4YmZhODhiMTkwMDA1
|
14
|
+
NWExZmQ1ZjJiMjQxZmFmMmIzOGY0ZGQ4MzU4MDQ4NjkxMmRkM2U2ZjEzNzdk
|
15
|
+
NmE3M2JmYmVmOWQxZDAzMTQ1NmM2NTUzNmM0ZTk2YTdiMTAwZWU=
|
data/README.md
CHANGED
@@ -26,9 +26,9 @@ Example: Interactive Ruby Shell
|
|
26
26
|
## require the gem in your shell session
|
27
27
|
require 'searchbing'
|
28
28
|
## create a new search object
|
29
|
-
|
29
|
+
bing_image = Bing.new('your_account_key_goes_here', 10, 'Image')
|
30
30
|
## retrieve the results for a given term
|
31
|
-
bing_results =
|
31
|
+
bing_results = bing_image.search("puffin")
|
32
32
|
## parse the results
|
33
33
|
puts bing_results[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail
|
34
34
|
|
data/lib/searchbing.rb
CHANGED
@@ -6,7 +6,7 @@ require 'net/http'
|
|
6
6
|
# Before proceeding you will need an account key, which can be obtained by registering an accout at http://windows.microsoft.com/en-US/windows-live/sign-in-what-is-microsoft-account
|
7
7
|
class Bing
|
8
8
|
# Create a new object of the bing class
|
9
|
-
# >>
|
9
|
+
# >> bing_image = Bing.new('your_account_key_goes_here', 10, 'Image')
|
10
10
|
# => #<Bing:0x9d9b9f4 @account_key="your_account_key", @num_results=10, @type="Image">
|
11
11
|
# Arguments:
|
12
12
|
# account_key: (String)
|
@@ -25,8 +25,8 @@ class Bing
|
|
25
25
|
attr_accessor :account_key, :num_results, :type
|
26
26
|
|
27
27
|
# Search for a term, the result is an array of hashes with the result data
|
28
|
-
# >>
|
29
|
-
# => [{"__metadata"=>{"uri"=>"https://api.datamarket.azure.com/Data.ashx/Bing/Search/Image?Query='
|
28
|
+
# >> bing_image.search("puffin")
|
29
|
+
# => [{"__metadata"=>{"uri"=>"https://api.datamarket.azure.com/Data.ashx/Bing/Search/Image?Query='puffin'&$skip=0&$top=1", "type"=>"Image
|
30
30
|
# Arguments:
|
31
31
|
# search_term: (String)
|
32
32
|
|
@@ -49,4 +49,4 @@ class Bing
|
|
49
49
|
body = JSON.parse(res.body)
|
50
50
|
result_set = body["d"]["results"]
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|