Class: Lexer::Identity::EnrichedResult

Inherits:
Object
  • Object
show all
Defined in:
lib/lexer/identity/enriched_result.rb

Overview

The treturned result of an Lexer::Identity.enrich request. Contains accessors for the returned id and attributes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ EnrichedResult

Returns a new instance of EnrichedResult.



14
15
16
17
18
# File 'lib/lexer/identity/enriched_result.rb', line 14

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

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



12
13
14
# File 'lib/lexer/identity/enriched_result.rb', line 12

def attributes
  @attributes
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/lexer/identity/enriched_result.rb', line 11

def id
  @id
end

Class Method Details

.from_json(json) ⇒ Object



20
21
22
23
# File 'lib/lexer/identity/enriched_result.rb', line 20

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