Class: EbayConnect
- Inherits:
-
Object
- Object
- EbayConnect
- Defined in:
- lib/ebay_ruby/connect.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
Instance Method Summary collapse
- #find_items_by_category(category_id, per_page) ⇒ Object
- #find_items_by_keywords(search_keyword, per_page) ⇒ Object
-
#find_items_by_product(product_id, per_page) ⇒ Object
productId can be ISBN,UPC,EAN.
- #get_connect(url) ⇒ Object
-
#initialize(app_id) ⇒ EbayConnect
constructor
A new instance of EbayConnect.
Constructor Details
#initialize(app_id) ⇒ EbayConnect
Returns a new instance of EbayConnect.
6 7 8 |
# File 'lib/ebay_ruby/connect.rb', line 6 def initialize(app_id) @app_id = app_id end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
10 11 12 |
# File 'lib/ebay_ruby/connect.rb', line 10 def app_id @app_id end |
Instance Method Details
#find_items_by_category(category_id, per_page) ⇒ Object
25 26 27 28 29 30 31 |
# 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) ⇒ Object
17 18 19 20 21 22 23 |
# 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) ⇒ Object
productId can be ISBN,UPC,EAN
33 34 35 36 37 38 39 |
# 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) ⇒ Object
12 13 14 15 |
# File 'lib/ebay_ruby/connect.rb', line 12 def get_connect(url) response = Net::HTTP.get_response url response.body end |