Class: Tray::Checkout::TempTransaction
- Inherits:
-
BaseService
- Object
- BaseService
- Tray::Checkout::TempTransaction
- Defined in:
- lib/tray/checkout/temp_transaction.rb
Instance Method Summary collapse
- #add_to_cart(params) ⇒ Object
- #api_url ⇒ Object
- #cart_url ⇒ Object
-
#initialize(token = nil) ⇒ TempTransaction
constructor
A new instance of TempTransaction.
Constructor Details
#initialize(token = nil) ⇒ TempTransaction
Returns a new instance of TempTransaction.
9 10 11 |
# File 'lib/tray/checkout/temp_transaction.rb', line 9 def initialize(token=nil) @token = token || Tray::Checkout.token_account end |
Instance Method Details
#add_to_cart(params) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/tray/checkout/temp_transaction.rb', line 17 def add_to_cart(params) @response = request("create", parser.response_params(params)) @token_transaction = @response.transaction[:token] if @response.transaction @response end |
#api_url ⇒ Object
5 6 7 |
# File 'lib/tray/checkout/temp_transaction.rb', line 5 def api_url "#{Tray::Checkout.api_url}/v1/tmp_transactions/" end |
#cart_url ⇒ Object
13 14 15 |
# File 'lib/tray/checkout/temp_transaction.rb', line 13 def cart_url "#{@response.transaction[:url_car]}#{@token_transaction}" if @token_transaction end |