Class: DaFace::Datasift::Interaction

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/da_face/datasift/interaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#parse_json, #parse_timestamp, #parse_uri, #symbolize_keys

Constructor Details

#initialize(data = {}) ⇒ Interaction



10
11
12
13
14
15
16
17
18
# File 'lib/da_face/datasift/interaction.rb', line 10

def initialize data={}
  allowed_attributes.each do |attr|
    unless data[attr].nil?
      self.instance_variable_set("@#{attr}".to_sym, data[attr])
    end
  end
  normalize_attributes!
  return self
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def author
  @author
end

#contentObject (readonly)

Returns the value of attribute content.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def content
  @content
end

#created_atObject (readonly)

Returns the value of attribute created_at.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def id
  @id
end

Returns the value of attribute link.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def link
  @link
end

#received_atObject (readonly)

Returns the value of attribute received_at.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def received_at
  @received_at
end

#schemaObject (readonly)

Returns the value of attribute schema.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def schema
  @schema
end

#sourceObject (readonly)

Returns the value of attribute source.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def source
  @source
end

#tag_treeObject (readonly)

Returns the value of attribute tag_tree.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def tag_tree
  @tag_tree
end

#tagsObject (readonly)

Returns the value of attribute tags.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/da_face/datasift/interaction.rb', line 6

def type
  @type
end

Instance Method Details

#allowed_attributesObject



20
21
22
23
24
# File 'lib/da_face/datasift/interaction.rb', line 20

def allowed_attributes
  [:author, :content, :created_at, :id, :link, 
   :received_at, :schema, :source, :type, :tags,
   :tag_tree]
end

#normalize_attributes!Object



26
27
28
29
# File 'lib/da_face/datasift/interaction.rb', line 26

def normalize_attributes!
  @created_at = parse_timestamp(@created_at) if @created_at
  @received_at = parse_timestamp(@received_at) if @received_at
end