Class: YANAPI::API
- Inherits:
-
Object
- Object
- YANAPI::API
- Defined in:
- lib/yanapi/api.rb
Constant Summary collapse
- REQUIRED_PARAMS =
[:method, :query_params]
- ACCEPTED_METHODS =
['questionSearch', 'getByUser', 'getByCategory', 'getQuestion' ]
Instance Method Summary collapse
-
#get ⇒ Object
This is a connector to the specific method in the query.
-
#initialize(params) ⇒ API
constructor
A new instance of API.
- #version ⇒ Object
Constructor Details
#initialize(params) ⇒ API
Returns a new instance of API.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yanapi/api.rb', line 19 def initialize(params) @params = check_params(params) @query = case @params[:method] when 'questionSearch' TermQuery.new(@params) when 'getByCategory' CategoryQuery.new(@params) when 'getByUser' UserQuery.new(@params) when 'getQuestion' QuestionQuery.new(@params) end end |
Instance Method Details
#get ⇒ Object
This is a connector to the specific method in the query.
36 37 38 |
# File 'lib/yanapi/api.rb', line 36 def get @query.get end |
#version ⇒ Object
40 41 42 |
# File 'lib/yanapi/api.rb', line 40 def version VERSION end |