Class: Binged::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/binged/client.rb

Overview

A client which encapsulates the Bing API

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Options Hash (options):

  • :api_key (String)

    The Bing API key used to make all API calls.



10
11
12
# File 'lib/binged/client.rb', line 10

def initialize(options = {})
  @api_key = options[:api_key] || Binged.api_key
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/binged/client.rb', line 6

def api_key
  @api_key
end

Instance Method Details

#image(query = '') ⇒ Object

Create a image search through Bing



24
25
26
# File 'lib/binged/client.rb', line 24

def image(query='')
  Search::Image.new(self,query)
end

#video(query = '') ⇒ Object

Create a video search through Bing



31
32
33
# File 'lib/binged/client.rb', line 31

def video(query='')
  Search::Video.new(self,query)
end

#web(query = '') ⇒ Object

Create a web search through Bing



17
18
19
# File 'lib/binged/client.rb', line 17

def web(query='')
  Search::Web.new(self,query)
end