Class: ContextIO::File

Inherits:
Object
  • Object
show all
Includes:
API::Resource
Defined in:
lib/contextio/file.rb

Instance Attribute Summary

Attributes included from API::Resource

#api_attributes, #primary_key, #resource_url

Instance Method Summary collapse

Methods included from API::Resource

#delete

Instance Method Details

#content ⇒ Object



50
51
52
# File 'lib/contextio/file.rb', line 50

def content
  @content ||= api.raw_request(:get, "#{resource_url}/content")
end


54
55
56
# File 'lib/contextio/file.rb', line 54

def content_link
  @content_link ||= api.raw_request(:get, "#{resource_url}/content", as_link: 1)
end

#embedded? ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/contextio/file.rb', line 46

def embedded?
  !!is_embedded
end

#from ⇒ Object



34
35
36
# File 'lib/contextio/file.rb', line 34

def from
  addresses['from']
end

#indexed_at ⇒ Object



26
27
28
# File 'lib/contextio/file.rb', line 26

def indexed_at
  @indexed_at ||= Time.at(indexed_at)
end

#person_info ⇒ Object



38
39
40
# File 'lib/contextio/file.rb', line 38

def person_info
  personInfo
end

#received_at ⇒ Object



22
23
24
# File 'lib/contextio/file.rb', line 22

def received_at
  @received_at ||= Time.at(date_received)
end


58
59
60
61
62
63
64
65
66
# File 'lib/contextio/file.rb', line 58

def related_files
  return @related_files if @related_files

  attribute_hashes = api.request(:get, "#{resource_url}/related")

  @related_files = FileCollection.new(api, attribute_hashes: attribute_hashes, account: )

  return @related_files
end

#revisions ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/contextio/file.rb', line 68

def revisions
  return @revisions if @revisions

  attribute_hashes = api.request(:get, "#{resource_url}/revisions")

  @revisions = FileCollection.new(api, attribute_hashes: attribute_hashes, account: )

  return @revisions
end

#tnef_part? ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/contextio/file.rb', line 42

def tnef_part?
  !!is_tnef_part
end

#to ⇒ Object



30
31
32
# File 'lib/contextio/file.rb', line 30

def to
  addresses['to']
end