Sha256: e2e169d5c9b46bacace399646a4ccc796369d1696db8c78433c48cf20d23b5cf

Contents?: true

Size: 790 Bytes

Versions: 6

Compression:

Stored size: 790 Bytes

Contents

module Inforouter #:nodoc:
  module Responses #:nodoc:
    # A generic response to an infoRouter API call.
    class Generic < Base
      # Response key.
      class_attribute :key

      class << self
        # Set the response key.
        #
        # @param key [String]
        def response_key(key)
          self.key = key
          response_success "#{key}_response/#{key}_result/response/@success"
          error_message "#{key}_response/#{key}_result/response/@error"
        end

        # Parse an infoRouter response.
        #
        # @param savon_response [Savon::Response]
        def parse(savon_response)
          response = new(savon_response)
          response.raw["#{key}_response".to_sym]["#{key}_result".to_sym][:response]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inforouter-0.3.0 lib/inforouter/responses/generic.rb
inforouter-0.2.9 lib/inforouter/responses/generic.rb
inforouter-0.2.8 lib/inforouter/responses/generic.rb
inforouter-0.2.7 lib/inforouter/responses/generic.rb
inforouter-0.2.6 lib/inforouter/responses/generic.rb
inforouter-0.2.0 lib/inforouter/responses/generic.rb