clearsaleID 1.2.0 → 1.2.1

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
  SHA256:
3
- metadata.gz: c7aaa3ecac0a4cb57110edab47db151ce07a8746df7757067da7b236779a9e5f
4
- data.tar.gz: 72214ebd650d6a336a9a8383ec07492d4ba1175311fcf17d1efbafe9a810a689
3
+ metadata.gz: 6ac3d35a33da3d5d071c0af973f5a6648a7a471b2e5ee14158e02e535c0364e9
4
+ data.tar.gz: b17585c2967174e8733a7498304a1c15df5bceb80350e3815ff680b9f20a4c47
5
5
  SHA512:
6
- metadata.gz: 676ce49998ebaaa3b809cc3a7622bcbabfe0304530e1221e202a8d18468cd8004f4eefda759592be9f4f66abd6791a7856101dd202b719631fb6e6abebe6eee8
7
- data.tar.gz: 8ccf6b59a6243a286d3f18550ba96111436eaa77cdc83284d1a1d7001df5cc7d91df7828aa04f6ea4f400be520c97ce36879bc6d3774182a4d78cfdd70d81f9d
6
+ metadata.gz: 9beb839770a5ad6e290c5f7676b4dd2be80a4c7526919b01b33b4709141b0c897ffd7af013a775e88eecdda8bdd0d721c32ec72250ba14f78f0d2be13dde6257
7
+ data.tar.gz: 0cb41901de81ae17c983f289d6c25dc64994da93ed0762475c2123641eacc6abc4a87513895769bcf9cbf6e04129766e2d17cdeac2cec421ad11ddbdf804bcde
@@ -5,9 +5,9 @@
5
5
  end
6
6
 
7
7
  def self.send_order(order_hash, payment_hash, user_hash)
8
- order = Clearsale::Object.new(order_hash)
9
- payment = Clearsale::Object.new(payment_hash)
10
- user = Clearsale::Object.new(user_hash)
8
+ order = Object.new(order_hash)
9
+ payment = Object.new(payment_hash)
10
+ user = Object.new(user_hash)
11
11
 
12
12
  order_xml = Clearsale::Order.to_xml(order, payment, user)
13
13
  request = {"xml" => order_xml}
@@ -8,7 +8,7 @@ module Clearsale
8
8
  class << self; self; end.class_eval do
9
9
  define_method(name) {
10
10
  v = @table[name]
11
- case v.class
11
+ case v
12
12
  when Hash
13
13
  Object.new(v)
14
14
  when Array
@@ -28,10 +28,10 @@ module Clearsale
28
28
  builder.tag!('QtdItens', order.items_count)
29
29
  builder.tag!('IP', user.last_sign_in_ip)
30
30
  builder.tag!('DadosCobranca') do |b|
31
- build_user_data(b, user, order.billing_address)
31
+ build_user_data(b, user, Object.new(order.billing_address))
32
32
  end
33
33
  builder.tag!('DadosEntrega') do |b|
34
- build_user_data(b, user, order.shipping_address)
34
+ build_user_data(b, user, Object.new(order.shipping_address))
35
35
  end
36
36
 
37
37
  builder.tag!('Pagamentos') do |b|
@@ -40,7 +40,7 @@ module Clearsale
40
40
 
41
41
  builder.tag!('Itens') do |b|
42
42
  order.order_items.each do |order_item|
43
- build_item(b, order_item)
43
+ build_item(b, Object.new(order_item))
44
44
  end
45
45
  end
46
46
  end
@@ -123,12 +123,15 @@ module Clearsale
123
123
 
124
124
  def self.build_item(builder, order_item)
125
125
  builder.tag!('Item') do |b|
126
- b.tag!('CodigoItem', order_item.product.product_id)
127
- b.tag!('NomeItem', order_item.product.name)
126
+ product = Object.new(order_item.product)
127
+ category = Object.new(product.category)
128
+
129
+ b.tag!('CodigoItem', product.product_id)
130
+ b.tag!('NomeItem', product.name)
128
131
  b.tag!('ValorItem', order_item.price)
129
132
  b.tag!('Quantidade', order_item.quantity)
130
- b.tag!('CodigoCategoria', order_item.product.category.category_id) if order_item.product.category.try(:category_id).present?
131
- b.tag!('NomeCategoria', order_item.product.category.name) if order_item.product.category.try(:name).present?
133
+ b.tag!('CodigoCategoria', category.category_id) if category.try(:category_id).present?
134
+ b.tag!('NomeCategoria', category.name) if category.try(:name).present?
132
135
  end
133
136
  end
134
137
  end
@@ -1,3 +1,3 @@
1
1
  module Clearsale
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearsaleID
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno Frank