Class: Pagseguro::Charge::PaymentResponse
- Inherits:
-
Object
- Object
- Pagseguro::Charge::PaymentResponse
- Defined in:
- lib/pagseguro/charge/payment_response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#message ⇒ Object
Returns the value of attribute message.
-
#reference ⇒ Object
Returns the value of attribute reference.
Class Method Summary collapse
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize ⇒ PaymentResponse
constructor
A new instance of PaymentResponse.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize ⇒ PaymentResponse
Returns a new instance of PaymentResponse.
9 10 |
# File 'lib/pagseguro/charge/payment_response.rb', line 9 def initialize end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
5 6 7 |
# File 'lib/pagseguro/charge/payment_response.rb', line 5 def code @code end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/pagseguro/charge/payment_response.rb', line 5 def @message end |
#reference ⇒ Object
Returns the value of attribute reference.
5 6 7 |
# File 'lib/pagseguro/charge/payment_response.rb', line 5 def reference @reference end |
Class Method Details
.fill_from_json(data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pagseguro/charge/payment_response.rb', line 18 def self.fill_from_json(data) return if data.nil? payment_response = new payment_response.code = data["code"] payment_response. = data["message"] payment_response.reference = data["reference"] payment_response end |
Instance Method Details
#as_json(options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/pagseguro/charge/payment_response.rb', line 30 def as_json(={}) { code: @code, message: @message, reference: @reference } end |
#to_json(*options) ⇒ Object
12 13 14 15 16 |
# File 'lib/pagseguro/charge/payment_response.rb', line 12 def to_json(*) hash = as_json(*) hash.reject! {|k,v| v.nil?} hash.to_json(*) end |