module Mercadolibre::Core::Users
Public Instance Methods
get_my_user()
click to toggle source
# File lib/mercadolibre/core/users.rb, line 29 def get_my_user get_request('/users/me', { access_token: @access_token }).body end
get_seller(nickname)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 12 def get_seller(nickname) response = search_items({ nickname: nickname, limit: 0 }) if response.seller.present? get_user(response.seller.id) else nil end end
get_user(user_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 8 def get_user(user_id) get_request("/users/#{user_id}", { access_token: @access_token }).body end
get_user_accepted_payment_methods(user_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 37 def get_user_accepted_payment_methods(user_id) get_request("/users/#{user_id}/accepted_payment_methods").body end
get_user_addresses(user_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 33 def get_user_addresses(user_id) get_request("/users/#{user_id}/addresses", { access_token: @access_token }).body end
get_user_available_listing_types(user_id, category_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 69 def get_user_available_listing_types(user_id, category_id) filters = { access_token: @access_token, category_id: category_id } get_request("/users/#{user_id}/available_listing_types", filters).body end
get_user_brand(user_id, brand_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 49 def get_user_brand(user_id, brand_id) get_request("/users/#{user_id}/brands/#{brand_id}", { access_token: @access_token }).body end
get_user_brands(user_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 45 def get_user_brands(user_id) get_request("/users/#{user_id}/brands", { access_token: @access_token }).body end
get_user_items(user_id, filters={})
click to toggle source
# File lib/mercadolibre/core/users.rb, line 87 def get_user_items(user_id, filters={}) token_attr = { access_token: @access_token } get_request("/users/#{user_id}/items/search", filters.merge(token_attr)).body end
get_user_listing_type_availability(listing_type, category_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 78 def get_user_listing_type_availability(listing_type, category_id) filters = { access_token: @access_token, category_id: category_id } get_request("/users/#{user_id}/available_listing_type/#{listing_type}", filters).body end
get_user_payment_methods(user_id)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 41 def get_user_payment_methods(user_id) get_request("/users/#{user_id}/payment_methods", { access_token: @access_token }).body end
get_user_promotion_packs(user_id, listing_type=nil, category_id=nil)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 53 def get_user_promotion_packs(user_id, listing_type=nil, category_id=nil) filters = { access_token: @access_token } if category_id.present? filters[:categoryId] = category_id end if listing_type.present? url = "/users/#{user_id}/classifieds_promotion_packs/#{listing_type}" else url = "/users/#{user_id}/classifieds_promotion_packs" end get_request(url, filters).body end
get_users(user_ids)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 4 def get_users(user_ids) get_request('/users', { ids: user_ids.join(',') }).body end
update_user(user_id, attrs)
click to toggle source
# File lib/mercadolibre/core/users.rb, line 21 def update_user(user_id, attrs) payload = attrs.to_json headers = { content_type: :json } put_request("/users/#{user_id}?access_token=#{@access_token}", payload, headers).body end