Class: Crefo::Service::Response

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

Defined Under Namespace

Classes: ParsingError, ResponseError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



9
10
11
12
13
14
15
# File 'lib/crefo/service/response.rb', line 9

def initialize(response)
  @response = response
  @body = ''
  @attachments = []
  parse_body
  parse_document
end

Instance Attribute Details

#attachmentsObject (readonly)

Returns the value of attribute attachments.



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

def attachments
  @attachments
end

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#document_hashObject (readonly)

Returns the value of attribute document_hash.



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

def document_hash
  @document_hash
end

Class Method Details

.response_nameObject



78
79
80
# File 'lib/crefo/service/response.rb', line 78

def response_name
  @response_name
end

.response_name=(response_name) ⇒ Object



82
83
84
# File 'lib/crefo/service/response.rb', line 82

def response_name=(response_name)
  @response_name = response_name
end

Instance Method Details

#document_body_hashObject



17
18
19
# File 'lib/crefo/service/response.rb', line 17

def document_body_hash
  document_reponse_hash[:body]
end

#document_fault_hashObject



25
26
27
# File 'lib/crefo/service/response.rb', line 25

def document_fault_hash
  document_hash.dig(:Envelope, :Body, :Fault)
end

#document_reponse_hashObject



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

def document_reponse_hash
  document_hash[:Envelope][:Body][:"#{self.class.response_name}Response"]
end

#response_idObject



29
30
31
# File 'lib/crefo/service/response.rb', line 29

def response_id
  document_reponse_hash[:header][:responseid]
end