Sha256: 92b9eca08e977332ff5811c00ce609b4a2342de9bd1bce7a0f81e6c6ba2236a4

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

require "ldbws/utils"

require "ldbws/response_types/parsing_functions"

# This module defines specific response types that map 1:1 with corresponding types in the LDBWS service schema. Sadly
# these are not especially well-documented.
#
# A lot of the Ruby side here works using a DSL to programatically define how XML nodes should be converted into Ruby
# objects: this is defined in {ParsingFunctions}.
module Ldbws::ResponseTypes # :nodoc:
  # \Base class which defines most of the functionality required by subclasses.
  class Base # :nodoc:
    include ParsingFunctions

    def method_missing(prop)
      @props.fetch(prop)
    end

    def to_h
      @props.to_h do |k, v|
        [
          k,
          Ldbws::Utils.deep_hashify_value(v),
        ]
      end
    end

    private

    def initialize(props)
      @props = props
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ldbws-1.0.3 lib/ldbws/response_types/base.rb
ldbws-1.0.2 lib/ldbws/response_types/base.rb
ldbws-1.0.1 lib/ldbws/response_types/base.rb
ldbws-1.0.0 lib/ldbws/response_types/base.rb