Sha256: ed5eca72948f438f347d6fab917bcdcce67ebbc8ad041f94dfb68ebfa8f3648c

Contents?: true

Size: 592 Bytes

Versions: 3

Compression:

Stored size: 592 Bytes

Contents

# encoding: utf-8
require 'multi_json'

# :nordoc:
module Lexer
  # :nordoc:
  module Identity
    # The treturned result of an +Lexer::Identity.enrich+ request.
    # Contains accessors for the returned +id+ and +attributes+.
    class EnrichedResult
      attr_accessor :id
      attr_accessor :attributes

      def initialize(args)
        args.each do |k, v|
          instance_variable_set("@#{k}", v) unless v.nil?
        end
      end

      def self.from_json(json)
        data = MultiJson.decode(json)
        Lexer::Identity::EnrichedResult.new(data)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lexer-identity-0.2.1 lib/lexer/identity/enriched_result.rb
lexer-identity-0.2.0 lib/lexer/identity/enriched_result.rb
lexer-identity-0.1.0 lib/lexer/identity/enriched_result.rb