Module: Mercadolibre::Core::Deals
- Included in:
- Api
- Defined in:
- lib/mercadolibre/core/deals.rb
Instance Method Summary collapse
- #get_deal_products(user_id, deal_id, filters = {}) ⇒ Object
- #get_deals_invited(user_id, filters = {}) ⇒ Object
- #remove_item_from_deal(user_id, deal_id, item_id) ⇒ Object
- #suggest_item_for_deal(user_id, deal_id, item_data) ⇒ Object
- #update_deal_item(user_id, deal_id, item_id, item_data) ⇒ Object
Instance Method Details
#get_deal_products(user_id, deal_id, filters = {}) ⇒ Object
10 11 12 13 14 |
# File 'lib/mercadolibre/core/deals.rb', line 10 def get_deal_products(user_id, deal_id, filters={}) filters.merge!({ access_token: @access_token }) get_request("/users/#{user_id}/deals/#{deal_id}/proposed_items/search", filters).body end |
#get_deals_invited(user_id, filters = {}) ⇒ Object
4 5 6 7 8 |
# File 'lib/mercadolibre/core/deals.rb', line 4 def get_deals_invited(user_id, filters={}) filters.merge!({ access_token: @access_token }) get_request("/users/#{user_id}/deals/search", filters).body end |
#remove_item_from_deal(user_id, deal_id, item_id) ⇒ Object
32 33 34 |
# File 'lib/mercadolibre/core/deals.rb', line 32 def remove_item_from_deal(user_id, deal_id, item_id) delete_request("/users/#{user_id}/deals/#{deal_id}/proposed_items/#{item_id}?access_token=#{@access_token}") end |
#suggest_item_for_deal(user_id, deal_id, item_data) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/mercadolibre/core/deals.rb', line 16 def suggest_item_for_deal(user_id, deal_id, item_data) payload = item_data.to_json headers = { content_type: :json, accept: :json } post_request("/users/#{user_id}/deals/#{deal_id}/proposed_items?access_token=#{@access_token}", payload, headers).body end |
#update_deal_item(user_id, deal_id, item_id, item_data) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/mercadolibre/core/deals.rb', line 24 def update_deal_item(user_id, deal_id, item_id, item_data) payload = item_data.to_json headers = { content_type: :json, accept: :json } put_request("/users/#{user_id}/deals/#{deal_id}/proposed_items/#{item_id}?access_token=#{@access_token}", payload, headers).body end |