Sha256: c025f63bfb01edbdd94a87dfab8797f8b46132a678790a25697d1d73d6ba8726

Contents?: true

Size: 1.56 KB

Versions: 2

Compression:

Stored size: 1.56 KB

Contents

module Biro
  module Bvs
    class ScoreResponseBuilder
      def initialize body
        @body = body.gsub("\n", '').scan(/<PRE>([^<>]*)<\/PRE>/imu).flatten[0]
      end

      def transaction
        @body[0..7]
      end

      def version
        @body[8..9]
      end

      def reserved_applicant
        @body[10..19]
      end

      def reserved_bvs
        @body[20..39]
      end

      def service_code
        @body[40..47]
      end

      def search_type
        @body[48..55]
      end

      def search_version
        @body[56..57]
      end

      def response_type
        @body[58]
      end

      def return_code
        @body[59]
      end

      def search_number
        @body[60..66]
      end

      def response_text_size
        @body[67..70].to_i
      end

      def response_text
        @body[71,response_text_size]
      end

      def response_text_init
        response_text[0..2]
      end

      def response_text_type
        response_text[3..5]
      end

      def response_text_is_present
        response_text[6]
      end

      def response_text_document_type
        response_text[7]
      end

      def response_text_document
        response_text[8..21]
      end

      def response_text_name
        response_text[22..136]
      end

      def response_text_result_score
        response_text[137..140]
      end

      def response_text_description
        response_text[141..160]
      end

      def response_text_over
        response_text[160..500]
      end

      def error_message
        response_text[8..100]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
biro-0.6.2 lib/biro/gateways/bvs/builders/score_response_builder.rb
biro-0.6.1 lib/biro/gateways/bvs/builders/score_response_builder.rb