Class: YANAPI::CategoryQuery

Inherits:
Query
  • Object
show all
Includes:
Common
Defined in:
lib/yanapi/category_query.rb

Constant Summary collapse

VALID_PARAMS =
[:category_id,
 :category_name,
 :date_range,
 :region,
 :results,
 :sort,
 :start,
 :type
]
REQUIRED_PARAMS =

Semantics differ here: OR, not AND.

[[:category_id, :category_name]]

Constants inherited from Query

Query::HOST, Query::MULTIVALUED_PARAMS, Query::SERVICE, Query::SERVICE_VERSION, Query::VALID_OUTPUT_FORMATS

Instance Method Summary collapse

Methods included from Common

#basic_check, #check_semantics

Methods inherited from Query

#build_url, #expand_params, #get, #get_response, #prove_xml

Constructor Details

#initialize(params) ⇒ CategoryQuery

Returns a new instance of CategoryQuery.



21
22
23
24
# File 'lib/yanapi/category_query.rb', line 21

def initialize(params)
  params[:method] = 'getByCategory'
  super
end

Instance Method Details

#check_params(params) ⇒ Object (private)

specific checks for CategoryQuery –



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/yanapi/category_query.rb', line 29

def check_params(params)
  unless params[:category_id] || params[:category_name] 
    raise Error, "Category is missing!"
  end

  allowed = %w{category_id category_name region
               date_range sort appid type start
               results output callback method
              }

  # in the module Common
  check_semantics(allowed, params)
  basic_check(params)

  super
end