searchbing 0.0.8 → 0.0.9

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.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/searchbing.rb +9 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGU0NzM5ODZkNmMyOTA2YjBiZDEyMzY4OTUzMDIxZWMxYjkxNzI4NQ==
4
+ YmE2ZWI1ZDU2YTU4ODZlMWEwMzM2MzQ4OWM1Nzc5NjA2MDRiMGI1ZQ==
5
5
  data.tar.gz: !binary |-
6
- N2I1NzUyOWEyNzIxNGI2Y2VmMmZjOWNjNmQzMjNlODc0NjVhM2M0Yg==
6
+ YzI4Njc4ZjMxNGU1NGY0YTMxNmIyODNjYWJlYmRjNWZjZDUwNTMyOA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZjlmZDY1NDE5NTM5YjRjZDNkMGRmZTQwOWQ3MTczZDUwMzFkNWU5NmI1ZTJl
10
- ZmI0MWQwZGJiYjMwMzI2MWY2YWRkYThhZWEwZGRlOTJjNzE1YzQwZjYyY2Jj
11
- YzYyNTJlOTNkODQzYjYyMGFkZjM5MGVjMjg1ODdjMzNmNDg2NmQ=
9
+ MmVkMmU5MjU5MjRiYjlkYjM5NjgyMjMxYjExY2M2NmJhMWM0NjMxMmI5ZDQz
10
+ MDY1MTdjNTdmMGQwZDM4ZDAwY2YxNjgzZTdjZWVjMDIwYzFlNTkzZTU2YjZl
11
+ NjdkYTUyZjZmOTMyOGZiZTcwODQ5OWM1ZDRhMWIwMThhNjlkZDg=
12
12
  data.tar.gz: !binary |-
13
- MTI5NzU3NGUzNmIwZGI1MGFmOGQ0MGJmYjQ5MzY5ZWVhZjM5NWI2Mjc2OTVk
14
- MGJjZTVjYTdjNjZjMmIwZTk1OTZmYzg5NTRmZWYzMzU3NmY5OWY1M2IxZDc1
15
- YzBlNTQwZDU5ZWJhYjMyMWRhMzJiYThjZjlmMzg4YmFmMTNhN2M=
13
+ MTA4Yjc5ZWRmMjE3YjE4ZmY0MzA2MjJiYmRhYjY5ZDhhM2M1YjAyNmYzN2Mw
14
+ YzQwOWI5ZTA4NTk3ZDY0MzJjMmUwZGNmYjRiMjU5MzRiNzA1ZDI2MGU5YWE1
15
+ Zjk4OTgxYjlkYmFmODZmOWM2ZmMwNjA5ZDZlNGU3MzczYzQzNWM=
data/lib/searchbing.rb CHANGED
@@ -1,27 +1,28 @@
1
+ # The Bing Class provides the ability to connect to the bing search api hosted on the windows azure marketplace.
2
+ # 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
1
3
  class Bing
2
4
  # Create a new object of the bing class
3
5
  # >> animals = Bing.new('your_account_key_goes_here', 10, 'Image')
4
- # => #<Bing:0x9d9b9f4 @accountKey="your_account_key", @num_results=10, @type="Image">
6
+ # => #<Bing:0x9d9b9f4 @account_key="your_account_key", @num_results=10, @type="Image">
5
7
  # Arguments:
6
8
  # account_key: (String)
7
9
  # num_results: (Integer)
8
10
  # type: (String)
9
11
 
10
- def initialize(accountKey, num_results, type)
12
+ def initialize(account_key, num_results, type)
11
13
 
12
- @accountKey = accountKey
14
+ @account_key = account_key
13
15
  @num_results = num_results
14
16
  @type = type
15
17
  end
16
18
 
17
- attr_accessor :accountKey, :num_results, :type
19
+ attr_accessor :account_key, :num_results, :type
18
20
 
19
21
  # Search for a term
20
22
  # >> animals.search("lion")
21
- # => #<Bing:0x9d9b9f4 @accountKey="your_account_key", @num_results=10, @type="Image">
23
+ # => "{\"d\":{\"results\":[{\"__metadata\":{\"uri\":\"https://api.datamarket....
22
24
  # Arguments:
23
25
  # search_term: (String)
24
- # => "{\"d\":{\"results\":[{\"__metadata\":{\"uri\":\"https://api.datamarket....
25
26
 
26
27
  def search(search_term)
27
28
 
@@ -33,12 +34,13 @@ class Bing
33
34
 
34
35
  uri = URI(full_address)
35
36
  req = Net::HTTP::Get.new(uri.request_uri)
36
- req.basic_auth user, accountKey
37
+ req.basic_auth user, account_key
37
38
 
38
39
  res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https'){|http|
39
40
  http.request(req)
40
41
  }
41
42
 
42
43
  res.body
44
+
43
45
  end
44
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchbing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Culliton