Class: Zootool::ItemsQuery

Inherits:
ZooQuery show all
Defined in:
lib/zootool/items_query.rb

Overview

Performs Zootool item queries to the Zootool API. This includes queries for popular items.

Usage: You don’t need to create an object of this class directly. Instead use the item method on your ZootoolApi object.

See zootool.com/api/docs/items for Items API documentation.

Instance Attribute Summary

Attributes inherited from ZooQuery

#api

Instance Method Summary collapse

Methods inherited from ZooQuery

#args_to_hash, #build_query_string, #initialize

Constructor Details

This class inherits a constructor from Zootool::ZooQuery

Instance Method Details

#info(uid) ⇒ Object

Returns the info for an item with the specified uid.

Returns a hash containing the item info.



19
20
21
22
# File 'lib/zootool/items_query.rb', line 19

def info(uid)
  hash = {:uid => uid}
  @api.request("items/info/?#{build_query_string(hash)}")
end

Returns the most popular items. The time period for which to return popular items may be specified via the type parameter. Valid values are: all, month, week, today. If not specified (or if an invalid time period is specified), it will default to all.

Returns an array of hashes containing item info.



31
32
33
34
35
# File 'lib/zootool/items_query.rb', line 31

def popular(type='all')
  # ensure only allowed popular types
  type = 'all' unless ['all','month','week','today'].include?(type)
  @api.request("items/popular/?type=#{type}")
end