Skip to content

Commit

Permalink
Merge branch 'azure' of https://github.com/koppen/rbing into azure
Browse files Browse the repository at this point in the history
Conflicts:
	lib/rbing.rb
  • Loading branch information
KellyMahan committed Aug 20, 2012
2 parents f9132fa + 2aa2d91 commit e50adbe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/rbing.rb
Expand Up @@ -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]

Expand Down Expand Up @@ -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+
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e50adbe

Please sign in to comment.