Permalink
Browse files

Merge branch 'azure' of https://github.com/koppen/rbing into azure

Conflicts:
	lib/rbing.rb
  • Loading branch information...
2 parents f9132fa + 2aa2d91 commit e50adbee27eaeac2de28f2cac1763870ee07a7ac @KellyMahan KellyMahan committed Aug 20, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/rbing.rb
View
@@ -80,9 +80,8 @@ def method_missing(*args)
include HTTParty
- attr_accessor :instance_options
+ attr_accessor :instance_options, :app_id
base_uri "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/v1/Web"
- format :json
BASE_OPTIONS = [:version, :market, :adult, :query, :appid]
@@ -128,7 +127,8 @@ def search(source, query, options={})
# +options+ can contain values to be passed with each query.
#
def initialize(app_id=nil, options={})
- @instance_options = options.merge(:AppId => (app_id || user_app_id))
+ @app_id = app_id
+ @instance_options = options
end
# constructs a query string for the given
# +query+ and the optional query +options+
@@ -176,9 +176,8 @@ def options_for(type, query, options={})
authentication_options = {:basic_auth => {
:username => '',
- :password => "#{@instance_options[:AppId]}"
+ :password => (app_id || user_app_id)
}}
- opts.delete(:AppId)
http_options = options[:http] || {}
http_options.merge!(authentication_options)
http_options.merge(:query => opts)

0 comments on commit e50adbe

Please sign in to comment.