Class: PagSeguro::Checkout

Inherits:
Base
  • Object
show all
Defined in:
lib/pagseguro/checkout.rb

Instance Attribute Summary

Attributes inherited from Base

#api

Instance Method Summary collapse

Methods inherited from Base

#builder, #initialize, #parameterize, #parse, #parse_body

Constructor Details

This class inherits a constructor from PagSeguro::Base

Instance Method Details

#create(params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/pagseguro/checkout.rb', line 3

def create(params)
  params = build_request(params).to_xml

  response = api.post "/v2/checkout", params do |conn|
    conn.headers[:content_type] = FORMATS[:xml]
    conn.headers[:accept] = FORMATS[:xml]
  end

  parse response.body["checkout"]
end

#url(code) ⇒ Object



14
15
16
# File 'lib/pagseguro/checkout.rb', line 14

def url(code)
  api.build_url :site, "/v2/checkout/payment.html", code: code
end