tray-checkout 0.3.0 → 0.3.1

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.
data/README.rdoc CHANGED
@@ -176,7 +176,7 @@ You can create or update carts through the Tray::Checkout::TempTransaction class
176
176
  After creating a cart you can forward your client using the cart_url method:
177
177
 
178
178
  temp_transaction = Tray::Checkout::TempTransaction.new
179
- temp_transaction.add_to_cart # => http://checkout.sandbox.tray.com.br/payment/car/v1/a906bf32cb59060dfc90769524f99d4a
179
+ temp_transaction.cart_url # => http://checkout.sandbox.tray.com.br/payment/car/v1/a906bf32cb59060dfc90769524f99d4a
180
180
 
181
181
  == Configurations
182
182
 
@@ -21,14 +21,6 @@ module Tray
21
21
  end
22
22
  end
23
23
 
24
- def cart_url
25
- if environment == :production
26
- "http://checkout.tray.com.br/"
27
- else
28
- "http://checkout.sandbox.tray.com.br/"
29
- end
30
- end
31
-
32
24
  def request_timeout
33
25
  (@request_timeout ||= DEFAULT_REQUEST_TIMEOUT).to_i
34
26
  end
@@ -11,11 +11,15 @@ module Tray
11
11
  end
12
12
 
13
13
  def cart_url
14
- "#{Tray::Checkout.cart_url}payment/car/v1/#{@token}" if @token
14
+ "#{@response.transaction[:url_car]}#{@token_transaction}" if @token_transaction
15
15
  end
16
16
 
17
17
  def add_to_cart(params)
18
- request("create", parser.transaction_params(params))
18
+ @response = request("create", parser.transaction_params(params))
19
+
20
+ @token_transaction = @response.transaction[:token] if @response.transaction
21
+
22
+ @response
19
23
  end
20
24
  end
21
25
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  module Tray
3
3
  module Checkout
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
6
6
  end
7
7
 
@@ -36,12 +36,18 @@ describe Tray::Checkout::TempTransaction do
36
36
 
37
37
  describe "#cart_url" do
38
38
  context 'when there is a cart created' do
39
- let(:transaction) { Tray::Checkout::TempTransaction.new(token) }
39
+ let(:transaction) { Tray::Checkout::TempTransaction.new(params[:token_account]) }
40
+
41
+ before do
42
+ VCR.use_cassette 'model/create_cart' do
43
+ @response = transaction.add_to_cart(params)
44
+ end
45
+ end
40
46
 
41
47
  it 'returns the URL' do
42
48
  url = transaction.cart_url
43
49
 
44
- url.should == "http://checkout.sandbox.tray.com.br/payment/car/v1/#{token}"
50
+ url.should == "http://checkout.sandbox.tray.com.br/payment/car/v1/31d7b7f786b6aa5749e8358374b7068f"
45
51
  end
46
52
  end
47
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tray-checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-25 00:00:00.000000000 Z
12
+ date: 2013-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  segments:
187
187
  - 0
188
- hash: -225133860779910176
188
+ hash: 2545084159827698806
189
189
  requirements: []
190
190
  rubyforge_project:
191
191
  rubygems_version: 1.8.25