Class: Bs2Api::Entities::Error
- Inherits:
-
Object
- Object
- Bs2Api::Entities::Error
- Defined in:
- lib/bs2_api/entities/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#description ⇒ Object
Returns the value of attribute description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Error
constructor
A new instance of Error.
- #to_hash ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Error
Returns a new instance of Error.
8 9 10 11 |
# File 'lib/bs2_api/entities/error.rb', line 8 def initialize(args = {}) @code = args.fetch(:code, nil) @description = args.fetch(:description, nil) end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/bs2_api/entities/error.rb', line 6 def code @code end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/bs2_api/entities/error.rb', line 6 def description @description end |
Class Method Details
.from_response(hash_payload) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/bs2_api/entities/error.rb', line 22 def self.from_response(hash_payload) return {} if hash_payload.blank? hash = ActiveSupport::HashWithIndifferentAccess.new(hash_payload) Bs2Api::Entities::Error.new( code: hash['erroCodigo'], description: hash['erroDescricao'] ) end |
Instance Method Details
#to_hash ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bs2_api/entities/error.rb', line 13 def to_hash hash_data = { "erroCodigo": @code, "erroDescricao": @description } ActiveSupport::HashWithIndifferentAccess.new(hash_data) end |