searchbing 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +9 -6
- data/lib/searchbing.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTU2ZGE5ZmRkZmI1NWNjZWEyNmM2ZGRjNjIxN2ExYjI0MWVlM2JlMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGNhZDg1MTc0MGMzZmM2OGU5ZWYwN2M3MDdjNjI3ZTYwNjU5YjU0OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGJhOGJjM2Y3ODE1YWViZTc0YTZlMTRmNzI4ZjhmM2IzMTM2NGM1MDI1Mjhl
|
10
|
+
OTJlZThlNjFmY2RkOTUyYzQ2NjY2MGNiN2RjNTIyZGY1ZjdlZWRmOTBlMGVj
|
11
|
+
NWRlMjIxZDU1ZGRjYzNjM2U0YWJiZTNjNzg3N2M4NmQzNjg3Mzc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmMwYzg2MDU2NmIyYmIyMjEzNTU3ZWIxZWU0MDhjMzBhYjc5OGFiMjRlMTFi
|
14
|
+
ZDhiNzEyMzYzZDVhYmQxZmY3OWYwMWE0MTUwZTQxYTg5Mjc0Mjc2NzA3MTk5
|
15
|
+
NWJlZTExMTUxMGMyNWViM2Y2OTQyYjI1Njk5YTVjOGM2NDU3MGQ=
|
data/README.md
CHANGED
@@ -6,19 +6,22 @@ Usage
|
|
6
6
|
============
|
7
7
|
1. create a new search object from the Bing class. Enter your recently obtained account key, the number of results you would like, and the search type.
|
8
8
|
2. valid search types include: Image, Web, or Video. The first letter must be capitalized
|
9
|
+
3. the searchbing gem relies on the open-uri, net/http, and json gems.
|
9
10
|
|
10
11
|
Example
|
11
12
|
===============
|
12
|
-
|
13
|
+
- Create a new search object
|
13
14
|
|
14
15
|
animals = Bing.new('your_account_key_goes_here', 10, 'Image')
|
15
16
|
|
16
|
-
|
17
|
+
- Retrieve the results for a given term
|
17
18
|
|
18
|
-
bing_results = animals.search("lion")
|
19
|
+
bing_results = animals.search("lion")
|
19
20
|
|
20
|
-
|
21
|
+
- parse the result set depending on what you would like to retrive
|
22
|
+
|
23
|
+
puts bing_results[0]["MediaUrl"] # puts url of fullsize image
|
24
|
+
|
25
|
+
puts bing_results[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail
|
21
26
|
|
22
|
-
puts result_set[0]["MediaUrl"] # puts url of fullsize image
|
23
|
-
puts result_set[0]["Thumbnail"]["MediaUrl"] # puts url of thumbnail
|
24
27
|
|
data/lib/searchbing.rb
CHANGED
@@ -49,4 +49,8 @@ class Bing
|
|
49
49
|
body = JSON.parse(res.body)
|
50
50
|
result_set = body["d"]["results"]
|
51
51
|
end
|
52
|
-
end
|
52
|
+
end
|
53
|
+
|
54
|
+
animals = Bing.new('MM6OD0qjozdOWWvspc0j4DRkn4JEBM0A/cEQFHDKTYo', 10, 'Image')
|
55
|
+
bing_results = animals.search("lion")
|
56
|
+
puts bing_results[0]["MediaUrl"]
|