Class: Agms::HPPResponse

Inherits:
Response show all
Defined in:
lib/agms/response/hpp_response.rb

Instance Method Summary collapse

Methods inherited from Response

#doMap, #mapResponse, #toArray

Constructor Details

#initialize(response, op) ⇒ HPPResponse

A class representing AGMS HPP Response objects.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/agms/response/hpp_response.rb', line 5

def initialize(response, op)
  super(response, op)
  @op = op
  @mapping = {'0' => 'hash', }
  @response = Hash.new
  @response['0'] = response
  @hash = response

  if not isSuccessful()
    raise ResponseError, 'HPP Generation failed with message ' + @hash
  end
end

Instance Method Details

#getHashObject



18
19
20
# File 'lib/agms/response/hpp_response.rb', line 18

def getHash
  return @hash
end

#isSuccessfulObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/agms/response/hpp_response.rb', line 22

def isSuccessful
  @hash = getHash()
  if ( not @hash or
      @hash == 0 or
      @hash.include? 'INVALID' or
      @hash.include? 'ERROR' or
      @hash.include? 'EXCEPTION' or
      @hash.include? 'REQUIRED' or
      @hash.include? 'IF USED' or
      @hash.include? 'MUST BE' or
      @hash.include? 'FAILED')
      return false
  else
      return true
  end
end