tray-checkout 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Nzc1NDkzMDAwNWYwZjNmMTczNmEyNzQ5ZTVmMjg5ZGY4OTQ3ZmVhZg==
4
+ MTZhMjQ2ZTYyZmI5OTYwZjZmMTRlNzhmMzU5MjZiMzkwNzE4OGQ5NQ==
5
5
  data.tar.gz: !binary |-
6
- NjkwODRhOWM3NDFmZTQ1ZGJhNjBkOWIyOGFhMjhjZTY5NjRiMTA4ZQ==
6
+ MjY4MmQ5Y2U1ZmI4NzhiNjBmYjg4NDg4MDBlMmIyM2U2YzFiMmUyMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmRlOTRjODE4MWE0NmE2M2M2ZGI1NGY4YzY0NGQ2OWRlNTM4YzBjYTM3YzJl
10
- NWNhYzhkZTNmNjNiZDI5OTczMGE2ZTE5Yzg3ZDUxZjQxMzM4NzQ5MzM1YmU2
11
- MDk0NDk2YzdhZTYyODQ2NzM5YjM1YzhkNTAwZDlkZDJjMzdhYTA=
9
+ YTk1YzFlMDkyYmZjODVkNTExZGQxMGI3YTg5ZTA3ZmI5ZDdiNTFhNzY3MmNh
10
+ ZjgzNzFiYzRmODJiODY4ZTBiZTU1NWQ3ZWEzMzhjN2U2ZGM1NDcwZTQ1Y2I4
11
+ NTFkMjBlMGVlZjlhNGE0NTc2NTNjMjQzODAwZWU0YmI5NjFiNjE=
12
12
  data.tar.gz: !binary |-
13
- YmFlOTc3MjA5ZDJhNGNhMWI2MDNjMzNhNzIzMTc5ZjA2YzU3MmYxMThmM2Q0
14
- ZDFjMjg1NGZmY2MyMDdjMWU5MDhiZWVmODk0NmRhZGI1NTcxYzNkODQ5MTVh
15
- ZWY1MzQwNmYyN2M4MzVjZWE2MGRlZjZjM2VlN2ZmMGQ0OGU5ZGE=
13
+ NTIwMDhlZWE1OWVjZTU5YjQ3N2ZjMjMzMTRhNzBmYmY0MWFmMmM4MTdjZDlj
14
+ YjQyZDRkYzY2YzFjNzMxNDY1YWZhZjA1MTJlMDE5OTBhODU0YmJlYTVhZjli
15
+ OGVkYzUzNWZhZDkyNWY2N2Y1OTFmODMxMDFjODk5YjcwYjllOGI=
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ == Version 0.4.2
2
+ - Avoid errors in TrayCheckout API when "url_img" parameter does not have a value.
3
+
1
4
  == Version 0.4.1
2
5
  - Update log-me gem version.
3
6
 
@@ -8,6 +8,7 @@ module Tray
8
8
 
9
9
  def parse
10
10
  token_account! @params
11
+ transaction_map! @params
11
12
  customer_map! @params[:customer]
12
13
  payment_map! @params[:payment]
13
14
  products_map! @params
@@ -20,6 +21,14 @@ module Tray
20
21
  params[:token_account] = Tray::Checkout.token_account if params[:token_account].nil?
21
22
  end
22
23
 
24
+ def transaction_map!(params)
25
+ return unless params[:transaction]
26
+
27
+ if params[:transaction][:url_img].to_s.empty?
28
+ params[:transaction].delete(:url_img)
29
+ end
30
+ end
31
+
23
32
  def customer_map!(customer)
24
33
  return unless customer
25
34
  customer[:birth_date] = customer[:birth_date].strftime("%d/%m/%Y") if customer[:birth_date] && customer[:birth_date].is_a?(Date)
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  module Tray
3
3
  module Checkout
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
6
6
  end
7
7
 
@@ -41,6 +41,7 @@ describe Tray::Checkout::ParamsParser do
41
41
  shipping_type: "Sedex",
42
42
  shipping_price: 13.94,
43
43
  url_notification: "http://prodis.blog.br/tray_notification",
44
+ url_img: "http://prodis.net.br/images/prodis_150.gif",
44
45
  products: [
45
46
  { code: "LOGO-8278",
46
47
  quantity: 2,
@@ -72,6 +73,19 @@ describe Tray::Checkout::ParamsParser do
72
73
  let(:response_params) { parser.parse }
73
74
 
74
75
  describe "#parse" do
76
+ context "when transaction has image URL" do
77
+ it "keeps image URL parameter" do
78
+ response_params[:transaction][:url_img].should == params[:transaction][:url_img]
79
+ end
80
+ end
81
+
82
+ context "when image URL is nil" do
83
+ it "removes image URL parameter" do
84
+ params[:transaction][:url_img] = nil
85
+ response_params[:transaction].has_key?(:url_img).should eq false
86
+ end
87
+ end
88
+
75
89
  it "sets customer gender expect API value" do
76
90
  response_params[:customer][:gender].should == "M"
77
91
  end
@@ -23,6 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_dependency "activesupport", "~> 3.1"
24
24
  gem.add_dependency "log-me", '0.0.9'
25
25
 
26
+ gem.add_development_dependency "pry"
26
27
  gem.add_development_dependency "rake"
27
28
  gem.add_development_dependency "rspec", "~> 2.12"
28
29
  gem.add_development_dependency "webmock", "~> 1.9"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tray-checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prodis a.k.a. Fernando Hamasaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2015-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.0.9
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -180,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
194
  version: '0'
181
195
  requirements: []
182
196
  rubyforge_project:
183
- rubygems_version: 2.2.2
197
+ rubygems_version: 2.4.2
184
198
  signing_key:
185
199
  specification_version: 4
186
200
  summary: Tray Checkout API