Class: WalmartOpen::Requests::Feed
- Inherits:
-
WalmartOpen::Request
- Object
- WalmartOpen::Request
- WalmartOpen::Requests::Feed
- Defined in:
- lib/walmart_open/requests/feed.rb
Constant Summary collapse
- TYPES =
[ :preorder, :bestsellers, :rollback, :clearance, :specialbuy ]
- CATEGORY_REQUIRED_TYPES =
TYPES - [:preorder]
Instance Attribute Summary
Attributes inherited from WalmartOpen::Request
Instance Method Summary collapse
-
#initialize(type, params = {}) ⇒ Feed
constructor
A new instance of Feed.
Methods inherited from WalmartOpen::Request
Constructor Details
#initialize(type, params = {}) ⇒ Feed
Returns a new instance of Feed.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/walmart_open/requests/feed.rb', line 15 def initialize(type, params = {}) unless TYPES.include?(type) raise ArgumentError, "Invalid feed type #{type}" end if !params[:category_id] && CATEGORY_REQUIRED_TYPES.include?(type) raise ArgumentError, "Category id param is required for the #{type} feed" end self.path = "feeds/#{type.to_s}" self.params = params end |