mercadolibre 0.14.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mercadolibre.rb +4 -80
- data/lib/mercadolibre/api.rb +56 -20
- data/lib/mercadolibre/core/auth.rb +8 -12
- data/lib/mercadolibre/core/categories_and_listings.rb +8 -24
- data/lib/mercadolibre/core/collections.rb +10 -0
- data/lib/mercadolibre/core/items_and_searches.rb +25 -60
- data/lib/mercadolibre/core/locations_and_currencies.rb +8 -29
- data/lib/mercadolibre/core/order_management.rb +77 -47
- data/lib/mercadolibre/core/questions.rb +10 -27
- data/lib/mercadolibre/core/shippings.rb +2 -4
- data/lib/mercadolibre/core/users.rb +5 -13
- data/lib/mercadolibre/version.rb +1 -1
- data/lib/mercadopago/api.rb +55 -20
- data/lib/mercadopago/core/auth.rb +12 -18
- data/lib/mercadopago/core/payments.rb +3 -12
- metadata +3 -77
- data/lib/mercadolibre/entity/address.rb +0 -40
- data/lib/mercadolibre/entity/address_agency.rb +0 -21
- data/lib/mercadolibre/entity/answer.rb +0 -25
- data/lib/mercadolibre/entity/atm_transfer_reference.rb +0 -21
- data/lib/mercadolibre/entity/auth.rb +0 -21
- data/lib/mercadolibre/entity/billing_info.rb +0 -21
- data/lib/mercadolibre/entity/card_configuration.rb +0 -23
- data/lib/mercadolibre/entity/card_issuer.rb +0 -21
- data/lib/mercadolibre/entity/category.rb +0 -28
- data/lib/mercadolibre/entity/category_settings.rb +0 -26
- data/lib/mercadolibre/entity/city.rb +0 -27
- data/lib/mercadolibre/entity/collector.rb +0 -21
- data/lib/mercadolibre/entity/cost_components.rb +0 -21
- data/lib/mercadolibre/entity/country.rb +0 -26
- data/lib/mercadolibre/entity/currency.rb +0 -21
- data/lib/mercadolibre/entity/currency_conversion_ratio.rb +0 -21
- data/lib/mercadolibre/entity/featured_item.rb +0 -28
- data/lib/mercadolibre/entity/feedback.rb +0 -35
- data/lib/mercadolibre/entity/feedback_reply.rb +0 -25
- data/lib/mercadolibre/entity/geolocation.rb +0 -21
- data/lib/mercadolibre/entity/gtin.rb +0 -21
- data/lib/mercadolibre/entity/item.rb +0 -55
- data/lib/mercadolibre/entity/item_attribute.rb +0 -21
- data/lib/mercadolibre/entity/item_description.rb +0 -27
- data/lib/mercadolibre/entity/item_payment_method.rb +0 -21
- data/lib/mercadolibre/entity/item_picture.rb +0 -21
- data/lib/mercadolibre/entity/item_shipping.rb +0 -22
- data/lib/mercadolibre/entity/listing_exposure.rb +0 -21
- data/lib/mercadolibre/entity/listing_price.rb +0 -26
- data/lib/mercadolibre/entity/listing_type.rb +0 -21
- data/lib/mercadolibre/entity/mediation.rb +0 -25
- data/lib/mercadolibre/entity/mediation_interaction.rb +0 -21
- data/lib/mercadolibre/entity/municipality.rb +0 -21
- data/lib/mercadolibre/entity/neighborhood.rb +0 -21
- data/lib/mercadolibre/entity/order.rb +0 -44
- data/lib/mercadolibre/entity/order_coupon.rb +0 -21
- data/lib/mercadolibre/entity/order_feedback.rb +0 -25
- data/lib/mercadolibre/entity/order_item.rb +0 -25
- data/lib/mercadolibre/entity/order_note.rb +0 -25
- data/lib/mercadolibre/entity/order_shipping.rb +0 -33
- data/lib/mercadolibre/entity/payment.rb +0 -35
- data/lib/mercadolibre/entity/payment_method.rb +0 -33
- data/lib/mercadolibre/entity/payment_plan.rb +0 -21
- data/lib/mercadolibre/entity/payment_promotion.rb +0 -28
- data/lib/mercadolibre/entity/phone.rb +0 -21
- data/lib/mercadolibre/entity/product_identifier.rb +0 -25
- data/lib/mercadolibre/entity/question.rb +0 -30
- data/lib/mercadolibre/entity/search_location.rb +0 -27
- data/lib/mercadolibre/entity/shipment.rb +0 -41
- data/lib/mercadolibre/entity/shipment_status_history.rb +0 -24
- data/lib/mercadolibre/entity/shipping_delivery.rb +0 -25
- data/lib/mercadolibre/entity/shipping_item.rb +0 -21
- data/lib/mercadolibre/entity/shipping_option.rb +0 -28
- data/lib/mercadolibre/entity/shipping_speed.rb +0 -21
- data/lib/mercadolibre/entity/site.rb +0 -28
- data/lib/mercadolibre/entity/site_domain.rb +0 -21
- data/lib/mercadolibre/entity/site_trend.rb +0 -21
- data/lib/mercadolibre/entity/state.rb +0 -27
- data/lib/mercadolibre/entity/user.rb +0 -34
- data/lib/mercadolibre/entity/zip_code.rb +0 -29
- data/lib/mercadopago/entity/additional_info.rb +0 -27
- data/lib/mercadopago/entity/address.rb +0 -21
- data/lib/mercadopago/entity/auth.rb +0 -21
- data/lib/mercadopago/entity/collector.rb +0 -29
- data/lib/mercadopago/entity/fee_detail.rb +0 -21
- data/lib/mercadopago/entity/identification.rb +0 -21
- data/lib/mercadopago/entity/money_request.rb +0 -32
- data/lib/mercadopago/entity/order.rb +0 -21
- data/lib/mercadopago/entity/payer.rb +0 -27
- data/lib/mercadopago/entity/payment.rb +0 -83
- data/lib/mercadopago/entity/phone.rb +0 -21
- data/lib/mercadopago/entity/refund.rb +0 -25
- data/lib/mercadopago/entity/shipments.rb +0 -21
- data/lib/mercadopago/entity/source.rb +0 -21
- data/lib/mercadopago/entity/transaction_details.rb +0 -28
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadolibre
|
2
|
-
module Entity
|
3
|
-
class SiteTrend
|
4
|
-
def self.attr_list
|
5
|
-
[:keyword, :url]
|
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
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mercadolibre
|
2
|
-
module Entity
|
3
|
-
class State
|
4
|
-
def self.attr_list
|
5
|
-
[:id, :name, :country, :cities]
|
6
|
-
end
|
7
|
-
|
8
|
-
attr_reader *attr_list
|
9
|
-
|
10
|
-
def initialize(attributes={})
|
11
|
-
attributes.each do |k, v|
|
12
|
-
if k.to_s == 'cities'
|
13
|
-
self.cities = v.map { |x| City.new(x) } unless v.nil?
|
14
|
-
elsif k.to_s == 'country'
|
15
|
-
self.country = Country.new(v) unless v.nil?
|
16
|
-
else
|
17
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_writer *attr_list
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Mercadolibre
|
2
|
-
module Entity
|
3
|
-
class User
|
4
|
-
def self.attr_list
|
5
|
-
[:id, :nickname, :registration_date, :first_name, :last_name, :blocked,
|
6
|
-
:country_id, :email, :user_type, :points, :site_id, :permalink, :phone,
|
7
|
-
:alternative_phone, :billing_info, :status, :power_seller_status,
|
8
|
-
:car_dealer, :real_estate_agency]
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_reader *attr_list
|
12
|
-
|
13
|
-
def initialize(attributes={})
|
14
|
-
attributes.each do |k, v|
|
15
|
-
if k.to_s == 'registration_date'
|
16
|
-
self.registration_date = Time.parse(v) unless v.nil?
|
17
|
-
elsif k.to_s == 'phone'
|
18
|
-
self.phone = Phone.new(v) unless v.nil?
|
19
|
-
elsif k.to_s == 'alternative_phone'
|
20
|
-
self.alternative_phone = Phone.new(v) unless v.nil?
|
21
|
-
elsif k.to_s == 'billing_info'
|
22
|
-
self.billing_info = BillingInfo.new(v) unless v.nil?
|
23
|
-
else
|
24
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_writer *attr_list
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Mercadolibre
|
2
|
-
module Entity
|
3
|
-
class ZipCode
|
4
|
-
def self.attr_list
|
5
|
-
[:zip_code, :city, :state, :country]
|
6
|
-
end
|
7
|
-
|
8
|
-
attr_reader *attr_list
|
9
|
-
|
10
|
-
def initialize(attributes={})
|
11
|
-
attributes.each do |k, v|
|
12
|
-
if k.to_s == 'state'
|
13
|
-
self.state = State.new(v) unless v.nil?
|
14
|
-
elsif k.to_s == 'country'
|
15
|
-
self.country = Country.new(v) unless v.nil?
|
16
|
-
elsif k.to_s == 'city'
|
17
|
-
self.country = City.new(v) unless v.nil?
|
18
|
-
else
|
19
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
attr_writer *attr_list
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class AdditionalInfo
|
4
|
-
def self.attr_list
|
5
|
-
[:items, :payer, :shipments]
|
6
|
-
end
|
7
|
-
|
8
|
-
attr_reader *attr_list
|
9
|
-
|
10
|
-
def initialize(attributes={})
|
11
|
-
attributes.each do |k, v|
|
12
|
-
if k.to_s == 'payer'
|
13
|
-
self.payer = Payer.new(v) unless v.nil?
|
14
|
-
elsif k.to_s == 'shipments'
|
15
|
-
self.shipments = Shipments.new(v) unless v.nil?
|
16
|
-
else
|
17
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_writer *attr_list
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Address
|
4
|
-
def self.attr_list
|
5
|
-
[:zip_code, :street_name, :street_number, :floor, :apartment]
|
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
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Auth
|
4
|
-
def self.attr_list
|
5
|
-
[:access_token, :refresh_token, :live_mode, :user_id, :token_type, :scope, :expires_in, :expired_at]
|
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
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Collector
|
4
|
-
def self.attr_list
|
5
|
-
[:id, :first_name, :phone, :email, :nickname, :identification, :last_name]
|
6
|
-
end
|
7
|
-
|
8
|
-
attr_reader *attr_list
|
9
|
-
|
10
|
-
def initialize(attributes={})
|
11
|
-
attributes.each do |k, v|
|
12
|
-
if k.to_s == 'identification'
|
13
|
-
self.identification = Identification.new(v) unless v.nil?
|
14
|
-
elsif k.to_s == 'phone'
|
15
|
-
self.phone = Phone.new(v) unless v.nil?
|
16
|
-
else
|
17
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_writer *attr_list
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class FeeDetail
|
4
|
-
def self.attr_list
|
5
|
-
[:amount, :fee_payer, :type]
|
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
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Identification
|
4
|
-
def self.attr_list
|
5
|
-
[:type, :number]
|
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
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class MoneyRequest
|
4
|
-
def self.attr_list
|
5
|
-
[:id, :status, :site_id, :currency_id, :amount, :collector_id, :collector_email, :payer_id, :payer_email,
|
6
|
-
:description, :concept_type, :init_point, :external_reference, :pref_id, :date_created, :last_updated]
|
7
|
-
end
|
8
|
-
|
9
|
-
attr_reader *attr_list
|
10
|
-
|
11
|
-
def initialize(attributes={})
|
12
|
-
attributes.each do |k, v|
|
13
|
-
if ['date_created', 'last_updated'].include?(k.to_s)
|
14
|
-
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
15
|
-
else
|
16
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
attr_writer *attr_list
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
{
|
31
|
-
|
32
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Order
|
4
|
-
def self.attr_list
|
5
|
-
[:id, :type]
|
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
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Payer
|
4
|
-
def self.attr_list
|
5
|
-
[:type, :id, :nickname, :email, :identification, :phone, :first_name, :last_name, :entity_type]
|
6
|
-
end
|
7
|
-
|
8
|
-
attr_reader *attr_list
|
9
|
-
|
10
|
-
def initialize(attributes={})
|
11
|
-
attributes.each do |k, v|
|
12
|
-
if k.to_s == 'identification'
|
13
|
-
self.identification = Identification.new(v) unless v.nil?
|
14
|
-
elsif k.to_s == 'phone'
|
15
|
-
self.phone = Phone.new(v) unless v.nil?
|
16
|
-
else
|
17
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
attr_writer *attr_list
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Payment
|
4
|
-
def self.attr_list
|
5
|
-
[
|
6
|
-
:id,
|
7
|
-
:date_created,
|
8
|
-
:date_approved,
|
9
|
-
:date_last_updated,
|
10
|
-
:money_release_date,
|
11
|
-
:operation_type,
|
12
|
-
:issuer_id,
|
13
|
-
:payment_method_id,
|
14
|
-
:payment_type_id,
|
15
|
-
:status,
|
16
|
-
:status_detail,
|
17
|
-
:currency_id,
|
18
|
-
:description,
|
19
|
-
:live_mode,
|
20
|
-
:sponsor_id,
|
21
|
-
:authorization_code,
|
22
|
-
:collector_id,
|
23
|
-
:collector,
|
24
|
-
:payer,
|
25
|
-
:metadata,
|
26
|
-
:order,
|
27
|
-
:external_reference,
|
28
|
-
:transaction_amount,
|
29
|
-
:transaction_amount_refunded,
|
30
|
-
:coupon_amount,
|
31
|
-
:shipping_cost,
|
32
|
-
:differential_pricing_id,
|
33
|
-
:deduction_schema,
|
34
|
-
:transaction_details,
|
35
|
-
:fee_details,
|
36
|
-
:captured,
|
37
|
-
:binary_mode,
|
38
|
-
:call_for_authorize_id,
|
39
|
-
:statement_descriptor,
|
40
|
-
:installments,
|
41
|
-
:card,
|
42
|
-
:notification_url,
|
43
|
-
:refunds,
|
44
|
-
:payer,
|
45
|
-
:application_id,
|
46
|
-
:additional_info
|
47
|
-
]
|
48
|
-
end
|
49
|
-
|
50
|
-
attr_reader *attr_list
|
51
|
-
|
52
|
-
def initialize(attributes={})
|
53
|
-
time_fields = ['date_created', 'date_approved', 'date_last_updated', 'money_release_date']
|
54
|
-
|
55
|
-
attributes.each do |k, v|
|
56
|
-
if time_fields.include?(k.to_s)
|
57
|
-
self.send("#{k}=", Time.parse(v)) unless v.nil?
|
58
|
-
elsif k.to_s == 'payer'
|
59
|
-
self.payer = Payer.new(v)
|
60
|
-
elsif k.to_s == 'collector'
|
61
|
-
self.collector = Collector.new(v)
|
62
|
-
elsif k.to_s == 'refunds'
|
63
|
-
self.refunds = v.map { |x| Refund.new(x) }
|
64
|
-
elsif k.to_s == 'transaction_details'
|
65
|
-
self.transaction_details = TransactionDetails.new(v)
|
66
|
-
elsif k.to_s == 'additional_info'
|
67
|
-
self.additional_info = AdditionalInfo.new(v)
|
68
|
-
elsif k.to_s == 'order'
|
69
|
-
self.order = Order.new(v)
|
70
|
-
elsif k.to_s == 'fee_details'
|
71
|
-
self.fee_details = v.map { |x| FeeDetail.new(x) }
|
72
|
-
else
|
73
|
-
self.send("#{k}=", v) if self.respond_to?(k)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
attr_writer *attr_list
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Mercadopago
|
2
|
-
module Entity
|
3
|
-
class Phone
|
4
|
-
def self.attr_list
|
5
|
-
[:area_code, :number, :extension]
|
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
|