Class: As2::Client::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/as2/client/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request:, response:, mic_matched:, mid_matched:, body:, disposition:, signature_verification_error:, exception:, outbound_message_id:) ⇒ Result

Returns a new instance of Result.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/as2/client/result.rb', line 6

def initialize(request:, response:, mic_matched:, mid_matched:, body:, disposition:, signature_verification_error:, exception:, outbound_message_id:)
  @request = request
  @response = response
  @mic_matched = mic_matched
  @mid_matched = mid_matched
  @body = body
  @disposition = disposition
  @signature_verification_error = signature_verification_error
  @exception = exception
  @outbound_message_id = outbound_message_id
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def body
  @body
end

#dispositionObject (readonly)

Returns the value of attribute disposition.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def disposition
  @disposition
end

#exceptionObject (readonly)

Returns the value of attribute exception.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def exception
  @exception
end

#mic_matchedObject (readonly)

Returns the value of attribute mic_matched.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def mic_matched
  @mic_matched
end

#mid_matchedObject (readonly)

Returns the value of attribute mid_matched.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def mid_matched
  @mid_matched
end

#outbound_message_idObject (readonly)

Returns the value of attribute outbound_message_id.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def outbound_message_id
  @outbound_message_id
end

#requestObject (readonly)

Returns the value of attribute request.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def response
  @response
end

#signature_verification_errorObject (readonly)

Returns the value of attribute signature_verification_error.



4
5
6
# File 'lib/as2/client/result.rb', line 4

def signature_verification_error
  @signature_verification_error
end

Instance Method Details

#disp_codeObject

legacy name. accessor for backwards-compatibility.



23
24
25
# File 'lib/as2/client/result.rb', line 23

def disp_code
  self.disposition
end

#signature_verifiedObject



18
19
20
# File 'lib/as2/client/result.rb', line 18

def signature_verified
  self.signature_verification_error.nil?
end

#successObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/as2/client/result.rb', line 27

def success
  # 'processed' is good (though may include warnings.)
  # 'processed/error' is not.
  downcased_disposition = self.disposition.to_s.downcase

  # TODO: we'll never have success if MDN is unsigned.
  self.signature_verified &&
  self.mic_matched &&
  self.mid_matched &&
  downcased_disposition.include?('processed') &&
  !downcased_disposition.include?('processed/error')
end