Class: Nelumba::File

Inherits:
Object
  • Object
show all
Includes:
Object
Defined in:
lib/nelumba/file.rb

Constant Summary

Constants included from Object

Object::USERNAME_REGULAR_EXPRESSION

Instance Attribute Summary collapse

Attributes included from Object

#author, #content, #display_name, #html, #image, #published, #summary, #text, #title, #uid, #updated, #url

Instance Method Summary collapse

Methods included from Object

#mentions, #reply_to, #to_as1, #to_html, #to_json, #to_text

Constructor Details

#initialize(options = {}, &blk) ⇒ File

Returns a new instance of File.



11
12
13
# File 'lib/nelumba/file.rb', line 11

def initialize(options = {}, &blk)
  init(options, &blk)
end

Instance Attribute Details

#file_urlObject (readonly)

Returns the value of attribute file_url.



5
6
7
# File 'lib/nelumba/file.rb', line 5

def file_url
  @file_url
end

#lengthObject (readonly)

Returns the value of attribute length.



8
9
10
# File 'lib/nelumba/file.rb', line 8

def length
  @length
end

#md5Object (readonly)

Returns the value of attribute md5.



9
10
11
# File 'lib/nelumba/file.rb', line 9

def md5
  @md5
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



6
7
8
# File 'lib/nelumba/file.rb', line 6

def mime_type
  @mime_type
end

Instance Method Details

#init(options = {}, &blk) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/nelumba/file.rb', line 15

def init(options = {}, &blk)
  super options

  @md5         = options[:md5]
  @file_url    = options[:file_url]
  @mime_type   = options[:mime_type]
  @length      = options[:length]
end

#to_hashObject



24
25
26
27
28
29
30
31
# File 'lib/nelumba/file.rb', line 24

def to_hash
  {
    :md5       => @md5,
    :file_url  => @file_url,
    :mime_type => @mime_type,
    :length    => @length
  }.merge(super)
end

#to_json_hashObject



33
34
35
36
37
38
39
40
41
# File 'lib/nelumba/file.rb', line 33

def to_json_hash
  {
    :objectType  => "file",
    :md5         => @md5,
    :fileUrl     => @file_url,
    :mimeType    => @mime_type,
    :length      => @length
  }.merge(super)
end