Class: PagSeguro::Session

Inherits:
Object
  • Object
show all
Includes:
Extensions::MassAssignment
Defined in:
lib/pagseguro/session.rb,
lib/pagseguro/session/response.rb,
lib/pagseguro/session/response_serializer.rb

Defined Under Namespace

Classes: Response, ResponseSerializer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#errorsObject



11
12
13
# File 'lib/pagseguro/session.rb', line 11

def errors
  @errors ||= Errors.new
end

#idObject

The session id.



6
7
8
# File 'lib/pagseguro/session.rb', line 6

def id
  @id
end

Class Method Details

.createObject

Create a payment session. Return a PagSeguro::Session instance.



17
18
19
20
21
22
23
# File 'lib/pagseguro/session.rb', line 17

def self.create
  response = Request.post("sessions", api_version)
  session = Session.new
  response = Response.new(response, session).serialize

  session
end

Instance Method Details

#update_attributes(attrs) ⇒ Object



25
26
27
# File 'lib/pagseguro/session.rb', line 25

def update_attributes(attrs)
  attrs.map { |name, value| send("#{name}=", value) }
end