class Rebay2::Shopping

Constants

VERSION

Public Class Methods

base_url_prefix() click to toggle source
# File lib/rebay2/shopping.rb, line 6
def base_url_prefix
  "http://open.api"
end
base_url_suffix() click to toggle source
# File lib/rebay2/shopping.rb, line 10
def base_url_suffix
  "ebay.com/shopping"
end

Public Instance Methods

find_half_products(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/FindHalfProducts.html

# File lib/rebay2/shopping.rb, line 27
def find_half_products(params)
  raise ArgumentError unless params[:ProductID] or params[:QueryKeywords] or
    (params[:'ProductID.Value'] && params[:'ProductID.type'])
  response = get_json_response(build_request_url('FindHalfProducts', params))
  if response.response.has_key?('Products') && response.response['Products'].has_key?('Product')
    response.results = response.response['Products']['Product']
  end
  return response
end
find_products(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/FindProducts.html

# File lib/rebay2/shopping.rb, line 16
def find_products(params)
  raise ArgumentError unless params[:CategoryID] or params[:ProductID] or params[:QueryKeywords] or
    (params[:'ProductID.Value'] && params[:'ProductID.type'])
  response = get_json_response(build_request_url('FindProducts', params))
  if response.response.has_key?('Product')
    response.results = response.response['Product']
  end
  return response
end
find_reviews_and_guides(params={}) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/FindReviewsandGuides.html

# File lib/rebay2/shopping.rb, line 105
def find_reviews_and_guides(params={})
  response = get_json_response(build_request_url('FindReviewsAndGuides', params))
  if response.response.has_key?('BuyingGuideDetails') && response.response['BuyingGuideDetails'].has_key?('BuyingGuide')
    response.results = response.response['BuyingGuideDetails']['BuyingGuide']
  end
  return response
end
get_category_info(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetCategoryInfo.html

# File lib/rebay2/shopping.rb, line 114
def get_category_info(params)
  raise ArgumentError unless params[:CategoryID]
  response = get_json_response(build_request_url('GetCategoryInfo', params))
  if response.response.has_key?('CategoryArray') && response.response['CategoryArray'].has_key?('Category')
    response.results = response.response['CategoryArray']['Category']
  end
  return response
end
get_category_info_with_children(params) click to toggle source
# File lib/rebay2/shopping.rb, line 123
def get_category_info_with_children(params)
  params[:IncludeSelector] = 'ChildCategories'
  response = get_category_info(params)
  return response
end
get_item_status(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetItemStatus.html

# File lib/rebay2/shopping.rb, line 48
def get_item_status(params)
  raise ArgumentError unless params[:ItemID]
  response = get_json_response(build_request_url('GetItemStatus', params))
  if response.response.has_key?('Item')
    response.results = response.response['Item']
  end
  return response
end
get_multiple_items(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetMultipleItems.html

# File lib/rebay2/shopping.rb, line 65
def get_multiple_items(params)
  raise ArgumentError unless params[:ItemID]
  response = get_json_response(build_request_url('GetMultipleItems', params))
  if response.response.has_key?('Item')
    response.results = response.response['Item']
  end
  return response
end
get_shipping_costs(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetShippingCosts.html

# File lib/rebay2/shopping.rb, line 58
def get_shipping_costs(params)
  raise ArgumentError unless params[:ItemID]
  response = get_json_response(build_request_url('GetShippingCosts', params))
  return response
end
get_single_item(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetSingleItem.html

# File lib/rebay2/shopping.rb, line 38
def get_single_item(params)
  raise ArgumentError unless params[:ItemID]
  response = get_json_response(build_request_url('GetSingleItem', params))
  if response.response.has_key?('Item')
    response.results = response.response['Item']
  end
  return response
end
get_user_profile(params) click to toggle source

developer.ebay.com/DevZone/shopping/docs/CallRef/GetUserProfile.html

# File lib/rebay2/shopping.rb, line 75
def get_user_profile(params)
  raise ArgumentError unless params[:UserID]
  response = get_json_response(build_request_url('GetUserProfile', params))
  if response.response.has_key?('User')
    response.results = response.response['User']
  end
  return response
end

Private Instance Methods

build_request_url(service, params=nil) click to toggle source
# File lib/rebay2/shopping.rb, line 130
def build_request_url(service, params=nil)
  url = "#{self.class.base_url}?callname=#{service}&appid=#{Rebay2::Api.app_id}&version=#{VERSION}&responseencoding=JSON"
  url += build_rest_payload({siteid: Rebay2::Api.default_site_id}.merge(params))
  return url
end