mercadolibre 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc38edf18e855e504da3e4046648edede1baaadf
4
- data.tar.gz: 2aed521c5bc6bcabf7b2b32ad617f69eb0e5366a
3
+ metadata.gz: cbdaa5ab3d6fcadb9ea5222b6bc04fe90575dc0c
4
+ data.tar.gz: b911148ea150bb3d1ba9bc5b93ac536e2fe81bfa
5
5
  SHA512:
6
- metadata.gz: 22caec256df1e9e743f36973dbd53775b00f6e8f5caaa378e64ed5b50152fadf274feee8c3b0ac17666f1dd169e6408e04979ef1a38d5bc15574bdb9de184e8c
7
- data.tar.gz: d531c0c587ae6f7f0e320a119075aeb99699c1ad68984bf66e7209e88ed930e1ba6824c9510a074a975bf85b8b9828fd55d74a8157ef2510dcf2bdaa2d33835e
6
+ metadata.gz: e9a62b4f42b58556244ca7f16b424a4ec248798a49ca6b5fcc6087a60fab66e543e8911bb1aefb5de650b8ea738dca95349b05671ab6586c4c33ffce28892566
7
+ data.tar.gz: 79931b60f3426e6f18863d7bb41c1637e51c1e63bdbef1edce494cb88b3bd593b7c984bee1f1c3ceb3c731280ac15fe0f8a4f1a7ca19dda9e1044c8b7599e726
data/CHANGELOG.md CHANGED
@@ -105,3 +105,7 @@
105
105
  ## v0.4.3
106
106
 
107
107
  * Bugfixes
108
+
109
+ ## v0.5.0
110
+
111
+ * Added get shipment method
data/lib/mercadolibre.rb CHANGED
@@ -2,6 +2,7 @@ require "mercadolibre/version"
2
2
 
3
3
  # entities
4
4
  require "mercadolibre/entity/address"
5
+ require "mercadolibre/entity/address_agency"
5
6
  require "mercadolibre/entity/answer"
6
7
  require "mercadolibre/entity/atm_transfer_reference"
7
8
  require "mercadolibre/entity/auth"
@@ -12,6 +13,7 @@ require "mercadolibre/entity/category"
12
13
  require "mercadolibre/entity/category_settings"
13
14
  require "mercadolibre/entity/city"
14
15
  require "mercadolibre/entity/collector"
16
+ require "mercadolibre/entity/cost_components"
15
17
  require "mercadolibre/entity/country"
16
18
  require "mercadolibre/entity/currency"
17
19
  require "mercadolibre/entity/currency_conversion_ratio"
@@ -24,6 +26,8 @@ require "mercadolibre/entity/item_picture"
24
26
  require "mercadolibre/entity/listing_exposure"
25
27
  require "mercadolibre/entity/listing_price"
26
28
  require "mercadolibre/entity/listing_type"
29
+ require "mercadolibre/entity/municipality"
30
+ require "mercadolibre/entity/neighborhood"
27
31
  require "mercadolibre/entity/order"
28
32
  require "mercadolibre/entity/order_coupon"
29
33
  require "mercadolibre/entity/order_feedback"
@@ -36,6 +40,8 @@ require "mercadolibre/entity/payment_plan"
36
40
  require "mercadolibre/entity/payment_promotion"
37
41
  require "mercadolibre/entity/phone"
38
42
  require "mercadolibre/entity/question"
43
+ require "mercadolibre/entity/shipment"
44
+ require "mercadolibre/entity/shipment_status_history"
39
45
  require "mercadolibre/entity/shipping_delivery"
40
46
  require "mercadolibre/entity/shipping_item"
41
47
  require "mercadolibre/entity/shipping_option"
@@ -53,6 +59,7 @@ require "mercadolibre/core/categories_and_listings"
53
59
  require "mercadolibre/core/items_and_searches"
54
60
  require "mercadolibre/core/locations_and_currencies"
55
61
  require "mercadolibre/core/order_management"
62
+ require "mercadolibre/core/shippings"
56
63
  require "mercadolibre/core/questions"
57
64
  require "mercadolibre/core/users"
58
65
  require "mercadolibre/api"
@@ -19,6 +19,7 @@ module Mercadolibre
19
19
  include Mercadolibre::Core::LocationsAndCurrencies
20
20
  include Mercadolibre::Core::OrderManagement
21
21
  include Mercadolibre::Core::Questions
22
+ include Mercadolibre::Core::Shippings
22
23
  include Mercadolibre::Core::Users
23
24
 
24
25
  private
@@ -0,0 +1,12 @@
1
+ module Mercadolibre
2
+ module Core
3
+ module Shippings
4
+ def get_shipment(shipment_id)
5
+ filters = { access_token: @access_token }
6
+ r = get_request("/shipments/#{shipment_id}", filters)
7
+
8
+ Mercadolibre::Entity::Shipment.new(r[:body])
9
+ end
10
+ end
11
+ end
12
+ end
@@ -2,8 +2,9 @@ module Mercadolibre
2
2
  module Entity
3
3
  class Address
4
4
  def self.attr_list
5
- [:state, :street_name, :city, :country, :address_line, :id,
6
- :zip_code, :longitude, :street_number, :latitude, :comment]
5
+ [:country, :state, :city, :neighborhood, :municipality, :types, :street_name,
6
+ :address_line, :id, :zip_code, :longitude, :street_number, :latitude, :comment,
7
+ :latitude, :longitude, :geolocation_type, :agency, :is_valid_for_carrier]
7
8
  end
8
9
 
9
10
  attr_reader *attr_list
@@ -16,6 +17,12 @@ module Mercadolibre
16
17
  self.city = City.new(v) unless v.nil?
17
18
  elsif k.to_s == 'country'
18
19
  self.country = Country.new(v) unless v.nil?
20
+ elsif k.to_s == 'neighborhood'
21
+ self.neighborhood = Neighborhood.new(v) unless v.nil?
22
+ elsif k.to_s == 'municipality'
23
+ self.municipality = Municipality.new(v) unless v.nil?
24
+ elsif k.to_s == 'agency'
25
+ self.agency = AddressAgency.new(v) unless v.nil?
19
26
  else
20
27
  self.send("#{k}=", v) if self.respond_to?(k)
21
28
  end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class AddressAgency
4
+ def self.attr_list
5
+ [:carrier_id, :agency_id, :description, :phone, :open_hours]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ self.send("#{k}=", v) if self.respond_to?(k)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ attr_writer *attr_list
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class CostComponents
4
+ def self.attr_list
5
+ [:special_discount]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ self.send("#{k}=", v) if self.respond_to?(k)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ attr_writer *attr_list
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class Municipality
4
+ def self.attr_list
5
+ [:id, :name]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ self.send("#{k}=", v) if self.respond_to?(k)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ attr_writer *attr_list
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class Neighborhood
4
+ def self.attr_list
5
+ [:id, :name]
6
+ end
7
+
8
+ attr_reader *attr_list
9
+
10
+ def initialize(attributes={})
11
+ attributes.each do |k, v|
12
+ self.send("#{k}=", v) if self.respond_to?(k)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ attr_writer *attr_list
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,41 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class Shipment
4
+ def self.attr_list
5
+ [:id, :mode, :created_by, :order_id, :order_cost, :site_id, :status, :substatus,
6
+ :status_history, :date_created, :last_updated, :tracking_number, :tracking_method,
7
+ :service_id, :sender_id, :sender_address, :receiver_id, :receiver_address, :shipping_items,
8
+ :shipping_option, :comments, :date_first_printed, :market_place, :return_details,
9
+ :application_id, :return_tracking_number, :cost_components, :picking_type]
10
+ end
11
+
12
+ attr_reader *attr_list
13
+
14
+ def initialize(attributes={})
15
+ attributes.each do |k, v|
16
+ if ['date_created', 'last_updated', 'date_first_printed'].include?(k.to_s)
17
+ self.send("#{k}=", Time.parse(v)) unless v.nil?
18
+ elsif k.to_s == 'status_history'
19
+ self.status_history = ShipmentStatusHistory.new(v) unless v.nil?
20
+ elsif k.to_s == 'sender_address'
21
+ self.sender_address = Address.new(v) unless v.nil?
22
+ elsif k.to_s == 'receiver_address'
23
+ self.receiver_address = Address.new(v) unless v.nil?
24
+ elsif k.to_s == 'shipping_items'
25
+ self.shipping_items = v.map { |x| ShippingItem.new(x) }
26
+ elsif k.to_s == 'shipping_option'
27
+ self.shipping_option = ShippingOption.new(v) unless v.nil?
28
+ elsif k.to_s == 'cost_components'
29
+ self.cost_components = CostComponents.new(v) unless v.nil?
30
+ else
31
+ self.send("#{k}=", v) if self.respond_to?(k)
32
+ end
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ attr_writer *attr_list
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,24 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class ShipmentStatusHistory
4
+ def self.attr_list
5
+ [:date_handling, :date_shipped, :date_delivered, :date_not_delivered,
6
+ :date_returned, :date_cancelled, :date_ready_to_ship, :date_first_visit]
7
+ end
8
+
9
+ attr_reader *attr_list
10
+
11
+ def initialize(attributes={})
12
+ attributes.each do |k, v|
13
+ if self.respond_to?(k)
14
+ self.send("#{k}=", Time.parse(v)) unless v.nil?
15
+ end
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ attr_writer *attr_list
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.4.3"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercadolibre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,8 +70,10 @@ files:
70
70
  - lib/mercadolibre/core/locations_and_currencies.rb
71
71
  - lib/mercadolibre/core/order_management.rb
72
72
  - lib/mercadolibre/core/questions.rb
73
+ - lib/mercadolibre/core/shippings.rb
73
74
  - lib/mercadolibre/core/users.rb
74
75
  - lib/mercadolibre/entity/address.rb
76
+ - lib/mercadolibre/entity/address_agency.rb
75
77
  - lib/mercadolibre/entity/answer.rb
76
78
  - lib/mercadolibre/entity/atm_transfer_reference.rb
77
79
  - lib/mercadolibre/entity/auth.rb
@@ -82,6 +84,7 @@ files:
82
84
  - lib/mercadolibre/entity/category_settings.rb
83
85
  - lib/mercadolibre/entity/city.rb
84
86
  - lib/mercadolibre/entity/collector.rb
87
+ - lib/mercadolibre/entity/cost_components.rb
85
88
  - lib/mercadolibre/entity/country.rb
86
89
  - lib/mercadolibre/entity/currency.rb
87
90
  - lib/mercadolibre/entity/currency_conversion_ratio.rb
@@ -94,6 +97,8 @@ files:
94
97
  - lib/mercadolibre/entity/listing_exposure.rb
95
98
  - lib/mercadolibre/entity/listing_price.rb
96
99
  - lib/mercadolibre/entity/listing_type.rb
100
+ - lib/mercadolibre/entity/municipality.rb
101
+ - lib/mercadolibre/entity/neighborhood.rb
97
102
  - lib/mercadolibre/entity/order.rb
98
103
  - lib/mercadolibre/entity/order_coupon.rb
99
104
  - lib/mercadolibre/entity/order_feedback.rb
@@ -106,6 +111,8 @@ files:
106
111
  - lib/mercadolibre/entity/payment_promotion.rb
107
112
  - lib/mercadolibre/entity/phone.rb
108
113
  - lib/mercadolibre/entity/question.rb
114
+ - lib/mercadolibre/entity/shipment.rb
115
+ - lib/mercadolibre/entity/shipment_status_history.rb
109
116
  - lib/mercadolibre/entity/shipping_delivery.rb
110
117
  - lib/mercadolibre/entity/shipping_item.rb
111
118
  - lib/mercadolibre/entity/shipping_option.rb