Sha256: e7ea952fcc1898aa5c03435a564d4d2e9023b182edc3a4209428b72998f5244d

Contents?: true

Size: 498 Bytes

Versions: 11

Compression:

Stored size: 498 Bytes

Contents

module RubyIsds
  module Responses
    class Body
      def initialize(response)
        (response.keys - self.class::REMOVED_KEYS).each do |key|
          self.class.send(:attr_accessor, key.to_sym)
          instance_variable_set("@#{key}", parsed_value(response[key]))
        end
      end

      private

      def parsed_value(value)
        return value unless value.is_a?(Hash)
        value.keys.first == 'xsi:nil' && value.values.first == 'true' ? nil : false
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby_isds-0.13.0 lib/ruby_isds/responses/body.rb
ruby_isds-0.12.0 lib/ruby_isds/responses/body.rb
ruby_isds-0.11.1 lib/ruby_isds/responses/body.rb
ruby_isds-0.11.0 lib/ruby_isds/responses/body.rb
ruby_isds-0.10.5 lib/ruby_isds/responses/body.rb
ruby_isds-0.10.4 lib/ruby_isds/responses/body.rb
ruby_isds-0.10.3 lib/ruby_isds/responses/body.rb
ruby_isds-0.10.2 lib/ruby_isds/responses/body.rb
ruby_isds-0.10.1 lib/ruby_isds/responses/body.rb
ruby_isds-0.9.1 lib/ruby_isds/responses/body.rb
ruby_isds-0.9.0 lib/ruby_isds/responses/body.rb