Class: Mundipagg::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mundipagg/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body = {}) ⇒ Response

Returns a new instance of Response.



7
8
9
# File 'lib/mundipagg/response.rb', line 7

def initialize(body = {})
  @body = body
end

Instance Attribute Details

#bodyObject (readonly) Also known as: payload

Returns the value of attribute body.



3
4
5
# File 'lib/mundipagg/response.rb', line 3

def body
  @body
end

Instance Method Details

#errorObject



15
16
17
18
19
# File 'lib/mundipagg/response.rb', line 15

def error
  ::Mundipagg::Error.new error_item[:description], error_item[:error_code]
rescue NoMethodError => event
  ::Mundipagg::Error.new "Unknown error", 0
end

#error_itemObject



21
22
23
# File 'lib/mundipagg/response.rb', line 21

def error_item
  raise "Not yet implemented"
end

#success?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/mundipagg/response.rb', line 11

def success?
  payload[:success]
end