Class: Bingo::BingoClient
- Inherits:
-
Object
- Object
- Bingo::BingoClient
- Defined in:
- lib/bingo.rb
Constant Summary collapse
- API_ENDPOINT =
"https://api.datamarket.azure.com/Bing/SearchWeb/v1/Web".freeze
Instance Attribute Summary collapse
-
#account_key ⇒ Object
readonly
Returns the value of attribute account_key.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(account_key, logger = ::Logger.new('/dev/null')) ⇒ BingoClient
constructor
A new instance of BingoClient.
- #search(query, options = {}) ⇒ Object
Constructor Details
#initialize(account_key, logger = ::Logger.new('/dev/null')) ⇒ BingoClient
Returns a new instance of BingoClient.
16 17 18 19 20 |
# File 'lib/bingo.rb', line 16 def initialize(account_key, logger = ::Logger.new('/dev/null')) @user = '' @account_key = account_key @logger = logger end |
Instance Attribute Details
#account_key ⇒ Object (readonly)
Returns the value of attribute account_key.
14 15 16 |
# File 'lib/bingo.rb', line 14 def account_key @account_key end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
14 15 16 |
# File 'lib/bingo.rb', line 14 def logger @logger end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
14 15 16 |
# File 'lib/bingo.rb', line 14 def user @user end |
Instance Method Details
#search(query, options = {}) ⇒ Object
22 23 24 25 26 |
# File 'lib/bingo.rb', line 22 def search(query, = {}) response = perform_search(query, ) json = JSON.parse(response.body) json["d"]["results"] end |