Module: Mercadolibre::Core::Shipping
- Included in:
- Api
- Defined in:
- lib/mercadolibre/core/shipping.rb
Instance Method Summary collapse
- #get_item_free_shipping_options(item_id, args = {}) ⇒ Object
- #get_order_shipments(order_id) ⇒ Object
- #get_shipment(shipment_id) ⇒ Object
- #get_shipment_labels(shipment_ids, attrs = {}) ⇒ Object
- #get_shipping_modes(site_id) ⇒ Object
- #get_shipping_options(item_id) ⇒ Object
- #get_shipping_services(site_id) ⇒ Object
- #get_site_free_shipping_options(site_id, args = {}) ⇒ Object
- #get_site_shipping_costs(site_id, attrs = {}) ⇒ Object
- #get_user_free_shipping_options(user_id, args = {}) ⇒ Object
- #get_user_shipping_costs(user_id, attrs = {}) ⇒ Object
- #get_user_shipping_modes(user_id, attrs = {}) ⇒ Object
- #get_user_shipping_preferences(user_id) ⇒ Object
- #update_shipment(shipment_id, attribs) ⇒ Object
Instance Method Details
#get_item_free_shipping_options(item_id, args = {}) ⇒ Object
73 74 75 |
# File 'lib/mercadolibre/core/shipping.rb', line 73 def (item_id, args={}) get_request("/items/#{item_id}/shipping_options/free", args).body end |
#get_order_shipments(order_id) ⇒ Object
45 46 47 48 |
# File 'lib/mercadolibre/core/shipping.rb', line 45 def get_order_shipments(order_id) filters = { access_token: @access_token } get_request("/orders/#{order_id}/shipments", filters).body end |
#get_shipment(shipment_id) ⇒ Object
4 5 6 7 |
# File 'lib/mercadolibre/core/shipping.rb', line 4 def get_shipment(shipment_id) filters = { access_token: @access_token } get_request("/shipments/#{shipment_id}", filters).body end |
#get_shipment_labels(shipment_ids, attrs = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/mercadolibre/core/shipping.rb', line 50 def get_shipment_labels(shipment_ids, attrs={}) if shipment_ids.is_a?(Array) shipment_ids_data = shipment_ids.join(',') else shipment_ids_data = shipment_ids end filters = attrs.merge({ access_token: @access_token, shipment_ids: shipment_ids_data }) get_request('/shipment_labels', filters, { api_response_kind: 'raw' }).body end |
#get_shipping_modes(site_id) ⇒ Object
21 22 23 |
# File 'lib/mercadolibre/core/shipping.rb', line 21 def get_shipping_modes(site_id) get_request("/sites/#{site_id}/shipping_methods").body end |
#get_shipping_options(item_id) ⇒ Object
17 18 19 |
# File 'lib/mercadolibre/core/shipping.rb', line 17 def (item_id) get_request("/items/#{item_id}/shipping_options").body end |
#get_shipping_services(site_id) ⇒ Object
25 26 27 |
# File 'lib/mercadolibre/core/shipping.rb', line 25 def get_shipping_services(site_id) get_request("/sites/#{site_id}/shipping_services").body end |
#get_site_free_shipping_options(site_id, args = {}) ⇒ Object
65 66 67 |
# File 'lib/mercadolibre/core/shipping.rb', line 65 def (site_id, args={}) get_request("/sites/#{site_id}/shipping_options/free", args).body end |
#get_site_shipping_costs(site_id, attrs = {}) ⇒ Object
29 30 31 |
# File 'lib/mercadolibre/core/shipping.rb', line 29 def get_site_shipping_costs(site_id, attrs={}) get_request("/sites/#{site_id}/shipping_options", attrs).body end |
#get_user_free_shipping_options(user_id, args = {}) ⇒ Object
69 70 71 |
# File 'lib/mercadolibre/core/shipping.rb', line 69 def (user_id, args={}) get_request("/users/#{user_id}/shipping_options/free", args).body end |
#get_user_shipping_costs(user_id, attrs = {}) ⇒ Object
37 38 39 |
# File 'lib/mercadolibre/core/shipping.rb', line 37 def get_user_shipping_costs(user_id, attrs={}) get_request("/users/#{user_id}/shipping_options", attrs).body end |
#get_user_shipping_modes(user_id, attrs = {}) ⇒ Object
33 34 35 |
# File 'lib/mercadolibre/core/shipping.rb', line 33 def get_user_shipping_modes(user_id, attrs={}) get_request("/users/#{user_id}/shipping_modes", attrs).body end |
#get_user_shipping_preferences(user_id) ⇒ Object
41 42 43 |
# File 'lib/mercadolibre/core/shipping.rb', line 41 def get_user_shipping_preferences(user_id) get_request("/users/#{user_id}/shipping_preferences").body end |
#update_shipment(shipment_id, attribs) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/mercadolibre/core/shipping.rb', line 9 def update_shipment(shipment_id, attribs) payload = attribs.to_json headers = { content_type: :json, accept: :json } put_request("/shipments/#{shipment_id}?access_token=#{@access_token}", payload, headers).body end |