class EbayConnect

Attributes

app_id[R]
build_uri[R]

Public Class Methods

new(app_id) click to toggle source
# File lib/ebay_ruby/connect.rb, line 6
def initialize(app_id)
  @app_id = app_id
end

Public Instance Methods

find_items_by_category(category_id, per_page) click to toggle source
# File lib/ebay_ruby/connect.rb, line 25
def find_items_by_category(category_id, per_page)
  str = __method__.to_s.camelize
  operation_name = str.gsub(str.first, str.first.downcase)
  search_param = "categoryId=#{category_id}"
  ebay_items = EbayFindItem.new(get_connect(build_uri(operation_name, search_param, per_page)))
  ebay_items.all_items
end
find_items_by_keywords(search_keyword, per_page) click to toggle source
# File lib/ebay_ruby/connect.rb, line 17
def find_items_by_keywords(search_keyword, per_page)
  str = __method__.to_s.camelize
  operation_name = str.gsub(str.first, str.first.downcase)
  search_param = "keywords=#{URI::encode(search_keyword)}"
  ebay_items = EbayFindItem.new(get_connect(build_uri(operation_name, search_param, per_page)))
  ebay_items.all_items
end
find_items_by_product(product_id, per_page) click to toggle source

productId can be ISBN,UPC,EAN

# File lib/ebay_ruby/connect.rb, line 33
def find_items_by_product(product_id, per_page)
  str = __method__.to_s.camelize
  operation_name = str.gsub(str.first, str.first.downcase)
  search_param = "productId=#{product_id}"
  ebay_items = EbayFindItem.new(get_connect(build_uri(operation_name, search_param, per_page)))
  ebay_items.all_items
end
get_connect(url) click to toggle source
# File lib/ebay_ruby/connect.rb, line 12
def get_connect(url)
  response = Net::HTTP.get_response url
  response.body
end