mercadolibre 0.1.5 → 0.2.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: 4b7ce86894418ee07e208995ac78488f9b862c28
4
- data.tar.gz: 5b6f461e60a6abb456f4a737c38fd7d64213cd00
3
+ metadata.gz: 4b7ce437cd9e41bf02c9aadbd87cc023914c25db
4
+ data.tar.gz: 975fd2465c6bf4b41d690259e0702b2c6332107c
5
5
  SHA512:
6
- metadata.gz: 292ea0a42bea74be2a5927bc052cca47e46ae2b94d410950d36af690c1842b3eb4c32e1c0752f929c57e42b10520923012587ff2c9e10ff53018aa60aa0fdcfb
7
- data.tar.gz: fb3046728c95cb207e5798de7b711d607e40d206afb9fc5ab59e1f1e83fa8381747a3c46c775e968a9fb713b4a9302f882b50aaa1a14f9cfd3de9cfa18d20075
6
+ metadata.gz: f841454622b86c0364b026377d3008a15cd52c7232eb7e3dc36e9a6a3eed20be496fe2d946491e716b2165ae34da44703c99c26fef1097d1dc991392b349c732
7
+ data.tar.gz: b5064c819dcce578511dd3e5dd5dd1180fd66fe7f3f017fffbd5decb25f341c511c98cd7f57429700b488bd161e9319b1acbdf0a0b604f86697a3be63eebe4f2
data/CHANGELOG.md CHANGED
@@ -57,3 +57,7 @@
57
57
  ## v0.1.5
58
58
 
59
59
  * Splitted question methods
60
+
61
+ ## v0.2.0
62
+
63
+ * Added payment method detail
data/lib/mercadolibre.rb CHANGED
@@ -3,6 +3,8 @@ require "mercadolibre/version"
3
3
  # entities
4
4
  require "mercadolibre/entity/answer"
5
5
  require "mercadolibre/entity/auth"
6
+ require "mercadolibre/entity/card_configuration"
7
+ require "mercadolibre/entity/card_issuer"
6
8
  require "mercadolibre/entity/category"
7
9
  require "mercadolibre/entity/category_settings"
8
10
  require "mercadolibre/entity/city"
@@ -21,6 +23,8 @@ require "mercadolibre/entity/order"
21
23
  require "mercadolibre/entity/order_item"
22
24
  require "mercadolibre/entity/payment"
23
25
  require "mercadolibre/entity/payment_method"
26
+ require "mercadolibre/entity/payment_plan"
27
+ require "mercadolibre/entity/payment_promotion"
24
28
  require "mercadolibre/entity/phone"
25
29
  require "mercadolibre/entity/question"
26
30
  require "mercadolibre/entity/site"
@@ -140,6 +140,12 @@ module Mercadolibre
140
140
  results[:body].map { |r| Mercadolibre::Entity::PaymentMethod.new(r) }
141
141
  end
142
142
 
143
+ def get_site_payment_method_info(site_id, payment_method_id)
144
+ results = get_request("/sites/#{site_id}/payment_methods/#{payment_method_id}")
145
+
146
+ Mercadolibre::Entity::PaymentMethod.new(results[:body])
147
+ end
148
+
143
149
  def get_order_blacklist(user_id)
144
150
  results = get_request("/users/#{user_id}/order_blacklist?access_token=#{@access_token}")
145
151
 
@@ -0,0 +1,23 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class CardConfiguration
4
+ def self.attr_list
5
+ [:bin_card_pattern, :bin_card_exclusion_pattern, :card_number_length,
6
+ :security_code_length, :luhn_algorithm, :installment_bins_pattern,
7
+ :additional_info_needed]
8
+ end
9
+
10
+ attr_reader *attr_list
11
+
12
+ def initialize(attributes={})
13
+ attributes.each do |k, v|
14
+ self.send("#{k}=", v) if self.respond_to?(k)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ attr_writer *attr_list
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class CardIssuer
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
@@ -2,14 +2,26 @@ module Mercadolibre
2
2
  module Entity
3
3
  class PaymentMethod
4
4
  def self.attr_list
5
- [:id, :name, :payment_type_id, :thumbnail, :secure_thumbnail]
5
+ [:id, :name, :payment_type_id, :card_issuer, :site_id, :thumbnail, :secure_thumbnail,
6
+ :labels, :min_accreditation_days, :max_accreditation_days, :payer_costs,
7
+ :exceptions_by_card_issuer, :card_configuration]
6
8
  end
7
9
 
8
10
  attr_reader *attr_list
9
11
 
10
12
  def initialize(attributes={})
11
13
  attributes.each do |k, v|
12
- self.send("#{k}=", v) if self.respond_to?(k)
14
+ if k.to_s == 'card_issuer'
15
+ self.card_issuer = CardIssuer.new(v)
16
+ elsif k.to_s == 'payer_costs'
17
+ self.payer_costs = v.map { |x| PaymentPlan.new(x) }
18
+ elsif k.to_s == 'exceptions_by_card_issuer'
19
+ self.exceptions_by_card_issuer = v.map { |x| PaymentPromotion.new(x) }
20
+ elsif k.to_s == 'card_configuration'
21
+ self.card_configuration = v.map { |x| CardConfiguration.new(x) }
22
+ else
23
+ self.send("#{k}=", v) if self.respond_to?(k)
24
+ end
13
25
  end
14
26
  end
15
27
 
@@ -0,0 +1,21 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class PaymentPlan
4
+ def self.attr_list
5
+ [:installments, :installment_rate, :labels, :min_allowed_amount, :max_allowed_amount]
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,28 @@
1
+ module Mercadolibre
2
+ module Entity
3
+ class PaymentPromotion
4
+ def self.attr_list
5
+ [:card_issuer, :labels, :thumbnail, :secure_thumbnail,
6
+ :payer_costs, :accepted_bins, :total_financial_cost]
7
+ end
8
+
9
+ attr_reader *attr_list
10
+
11
+ def initialize(attributes={})
12
+ attributes.each do |k, v|
13
+ if k.to_s == 'card_issuer'
14
+ self.card_issuer = CardIssuer.new(v)
15
+ elsif k.to_s == 'payer_costs'
16
+ self.payer_costs = v.map { |x| PaymentPlan.new(x) }
17
+ else
18
+ self.send("#{k}=", v) if self.respond_to?(k)
19
+ end
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ attr_writer *attr_list
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module Mercadolibre
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.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.1.5
4
+ version: 0.2.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-08-29 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,6 +73,8 @@ files:
73
73
  - lib/mercadolibre/core/users.rb
74
74
  - lib/mercadolibre/entity/answer.rb
75
75
  - lib/mercadolibre/entity/auth.rb
76
+ - lib/mercadolibre/entity/card_configuration.rb
77
+ - lib/mercadolibre/entity/card_issuer.rb
76
78
  - lib/mercadolibre/entity/category.rb
77
79
  - lib/mercadolibre/entity/category_settings.rb
78
80
  - lib/mercadolibre/entity/city.rb
@@ -91,6 +93,8 @@ files:
91
93
  - lib/mercadolibre/entity/order_item.rb
92
94
  - lib/mercadolibre/entity/payment.rb
93
95
  - lib/mercadolibre/entity/payment_method.rb
96
+ - lib/mercadolibre/entity/payment_plan.rb
97
+ - lib/mercadolibre/entity/payment_promotion.rb
94
98
  - lib/mercadolibre/entity/phone.rb
95
99
  - lib/mercadolibre/entity/question.rb
96
100
  - lib/mercadolibre/entity/site.rb