Class: Rmoip::ResponseApi
- Inherits:
-
Object
- Object
- Rmoip::ResponseApi
- Defined in:
- lib/moip/response_api.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#status ⇒ Object
Returns the value of attribute status.
-
#token ⇒ Object
Returns the value of attribute token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ResponseApi
constructor
A new instance of ResponseApi.
- #is_successful ⇒ Object
- #to_s ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize ⇒ ResponseApi
Returns a new instance of ResponseApi.
6 7 8 |
# File 'lib/moip/response_api.rb', line 6 def initialize @errors = Array.new end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/moip/response_api.rb', line 4 def base_uri @base_uri end |
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/moip/response_api.rb', line 4 def errors @errors end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/moip/response_api.rb', line 4 def status @status end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/moip/response_api.rb', line 4 def token @token end |
Class Method Details
.build(params) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/moip/response_api.rb', line 10 def self.build(params) response = self.new response.token = params["Token"] response.status = params["Status"] params["Erro"].each do |erro| response.errors.push erro end response end |
Instance Method Details
#is_successful ⇒ Object
20 21 22 |
# File 'lib/moip/response_api.rb', line 20 def is_successful self.status == "Sucesso" end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/moip/response_api.rb', line 28 def to_s "token #{token}, status: #{status}, Total de error: #{errors}" end |
#url ⇒ Object
24 25 26 |
# File 'lib/moip/response_api.rb', line 24 def url @base_uri << "/Instrucao.do?token=" << token end |