Class: Providers::Google::Api
Instance Method Summary collapse
- #find_business_by_id(google_id) ⇒ Object
- #find_business_by_name(name, business_type, city_state = "") ⇒ Object
- #find_reviews_for_business(ref) ⇒ Object
-
#initialize(options) ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize(options) ⇒ Api
Returns a new instance of Api.
7 8 9 |
# File 'lib/providers/google/api.rb', line 7 def initialize() @key = [:key] end |
Instance Method Details
#find_business_by_id(google_id) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/providers/google/api.rb', line 23 def find_business_by_id(google_id) request_url = reviews_url(google_id) @json_results = HTTParty.get(request_url) return @json_results if @json_results.nil? json = @json_results["result"] return json if json.nil? Providers::Google::Business.build_business(json) end |
#find_business_by_name(name, business_type, city_state = "") ⇒ Object
11 12 13 14 15 |
# File 'lib/providers/google/api.rb', line 11 def find_business_by_name(name, business_type, city_state = "") request_url = business_url(name, business_type) @json_results = HTTParty.get(request_url) parse_business_results(@json_results) end |
#find_reviews_for_business(ref) ⇒ Object
17 18 19 20 21 |
# File 'lib/providers/google/api.rb', line 17 def find_reviews_for_business(ref) request_url = reviews_url(ref) @json_results = HTTParty.get(request_url) parse_reviews_results(@json_results) end |