Class: Yelp::Request
Direct Known Subclasses
Neighborhood::Request::Base, Phone::Request::Number, Yelp::Review::Request::Base
Instance Attribute Summary collapse
-
#compress_response ⇒ Object
(also: #compress_response?)
readonly
specifies whether the response content should be transmitted over the wire compressed, defaulting to true.
-
#response_format ⇒ Object
readonly
one of the Yelp::ResponseFormat format specifiers detailing the desired format of the search results, defaulting to Yelp::ResponseFormat::JSON_TO_RUBY.
-
#yws_id ⇒ Object
readonly
the Yelp Web Services ID to be passed with the request for authentication purposes.
Instance Method Summary collapse
-
#initialize(params) ⇒ Request
constructor
A new instance of Request.
- #to_yelp_params ⇒ Object
Constructor Details
#initialize(params) ⇒ Request
Returns a new instance of Request.
21 22 23 24 25 26 27 |
# File 'lib/yelp/request.rb', line 21 def initialize (params) default_params = { :compress_response => true, :response_format => Yelp::ResponseFormat::JSON_TO_RUBY } super(default_params.merge(params)) end |
Instance Attribute Details
#compress_response ⇒ Object (readonly) Also known as: compress_response?
specifies whether the response content should be transmitted over the wire compressed, defaulting to true.
7 8 9 |
# File 'lib/yelp/request.rb', line 7 def compress_response @compress_response end |
#response_format ⇒ Object (readonly)
one of the Yelp::ResponseFormat format specifiers detailing the desired format of the search results, defaulting to Yelp::ResponseFormat::JSON_TO_RUBY.
12 13 14 |
# File 'lib/yelp/request.rb', line 12 def response_format @response_format end |
#yws_id ⇒ Object (readonly)
the Yelp Web Services ID to be passed with the request for authentication purposes. See www.yelp.com/developers/getting_started/api_access to get your own.
17 18 19 |
# File 'lib/yelp/request.rb', line 17 def yws_id @yws_id end |
Instance Method Details
#to_yelp_params ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/yelp/request.rb', line 29 def to_yelp_params params = { :ywsid => yws_id } # if they specified anything other than a json variant, we # need to tell yelp what we're looking for case @response_format when Yelp::ResponseFormat::PICKLE params[:output] = 'pickle' when Yelp::ResponseFormat::PHP params[:output] = 'php' end params end |