class BingSearchClient::Result
Attributes
body[R]
expanded_url[R]
Public Class Methods
build_from_array_response(raw_response:)
click to toggle source
# File lib/bing_search_client/result.rb, line 10 def self.build_from_array_response(raw_response:) raw_response.map do |result_json_response| new(body: result_json_response).tap do |result| result.expand_url! end end end
new(body:)
click to toggle source
# File lib/bing_search_client/result.rb, line 5 def initialize(body:) @body = body @expanded_url = nil end
Public Instance Methods
expand_url!()
click to toggle source
Instance method to get the real url insted of the url bing
# File lib/bing_search_client/result.rb, line 19 def expand_url! bing_url = URI(body[:url]) parsed_query = CGI::parse(bing_url.query) @expanded_url = parsed_query['r'].first end