Class: PagSeguro::Authorization
- Inherits:
-
Object
- Object
- PagSeguro::Authorization
- Defined in:
- lib/pagseguro/authorization.rb,
lib/pagseguro/authorization/response.rb,
lib/pagseguro/authorization/collection.rb,
lib/pagseguro/authorization/request_serializer.rb,
lib/pagseguro/authorization/response_serializer.rb
Defined Under Namespace
Classes: Collection, RequestSerializer, Response, ResponseSerializer
Instance Attribute Summary collapse
-
#code ⇒ Object
The authorization code.
-
#created_at ⇒ Object
The authorization creation date.
-
#permissions ⇒ Object
The authorization permissions.
-
#reference ⇒ Object
The reference related to the authorization.
Attributes included from Extensions::Credentiable
Class Method Summary collapse
- .find_by(options) ⇒ Object
-
.find_by_code(code, options = {}) ⇒ Object
Find an authorization by it’s code.
-
.find_by_notification_code(code, options = {}) ⇒ Object
Find an authorization by it’s notification code.
Instance Method Summary collapse
Methods included from Extensions::MassAssignment
Instance Attribute Details
#code ⇒ Object
The authorization code
7 8 9 |
# File 'lib/pagseguro/authorization.rb', line 7 def code @code end |
#created_at ⇒ Object
The authorization creation date
10 11 12 |
# File 'lib/pagseguro/authorization.rb', line 10 def created_at @created_at end |
#permissions ⇒ Object
The authorization permissions
16 17 18 |
# File 'lib/pagseguro/authorization.rb', line 16 def @permissions end |
#reference ⇒ Object
The reference related to the authorization
13 14 15 |
# File 'lib/pagseguro/authorization.rb', line 13 def reference @reference end |
Class Method Details
.find_by(options) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/pagseguro/authorization.rb', line 36 def self.find_by() request = Request.get("authorizations", api_version, RequestSerializer.new().to_params) collection = Collection.new Response.new(request, collection).serialize_collection collection end |
.find_by_code(code, options = {}) ⇒ Object
Find an authorization by it’s code
28 29 30 31 32 33 34 |
# File 'lib/pagseguro/authorization.rb', line 28 def self.find_by_code(code, = {}) request = Request.get("authorizations/#{code}", api_version, ) = PagSeguro::Authorization.new Response.new(request, ).serialize end |
.find_by_notification_code(code, options = {}) ⇒ Object
Find an authorization by it’s notification code
19 20 21 22 23 24 25 |
# File 'lib/pagseguro/authorization.rb', line 19 def self.find_by_notification_code(code, = {}) request = Request.get("authorizations/notifications/#{code}", api_version, ) = PagSeguro::Authorization.new Response.new(request, ).serialize end |
Instance Method Details
#errors ⇒ Object
48 49 50 |
# File 'lib/pagseguro/authorization.rb', line 48 def errors @errors ||= Errors.new end |
#update_attributes(attrs) ⇒ Object
44 45 46 |
# File 'lib/pagseguro/authorization.rb', line 44 def update_attributes(attrs) attrs.map { |name, value| send("#{name}=", value) } end |