Class: Geti::Response
- Inherits:
-
Object
- Object
- Geti::Response
- Defined in:
- lib/geti/response.rb
Instance Attribute Summary collapse
-
#authorization ⇒ Object
readonly
Returns the value of attribute authorization.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#validation ⇒ Object
readonly
Returns the value of attribute validation.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 9 10 |
# File 'lib/geti/response.rb', line 6 def initialize(response) @validation = OpenStruct.new(response[:response][:validation_message]) @authorization = OpenStruct.new(response[:response][:authorization_message]) @exception = OpenStruct.new(response[:response][:exception]) end |
Instance Attribute Details
#authorization ⇒ Object (readonly)
Returns the value of attribute authorization.
4 5 6 |
# File 'lib/geti/response.rb', line 4 def @authorization end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
4 5 6 |
# File 'lib/geti/response.rb', line 4 def exception @exception end |
#validation ⇒ Object (readonly)
Returns the value of attribute validation.
4 5 6 |
# File 'lib/geti/response.rb', line 4 def validation @validation end |
Instance Method Details
#errors ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/geti/response.rb', line 12 def errors err = [] Array(@validation.validation_error).each do |e| err << e[:message] end err << @exception. err.compact end |
#success? ⇒ Boolean
21 22 23 |
# File 'lib/geti/response.rb', line 21 def success? validation.result == "Passed" end |