Class: Nelumba::Binary

Inherits:
Object
  • Object
show all
Includes:
Object
Defined in:
lib/nelumba/binary.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) ⇒ Binary

Returns a new instance of Binary.



14
15
16
# File 'lib/nelumba/binary.rb', line 14

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

Instance Attribute Details

#compressionObject (readonly)

Returns the value of attribute compression.



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

def compression
  @compression
end

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#file_urlObject (readonly)

Returns the value of attribute file_url.



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

def file_url
  @file_url
end

#lengthObject (readonly)

Returns the value of attribute length.



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

def length
  @length
end

#md5Object (readonly)

Returns the value of attribute md5.



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

def md5
  @md5
end

#mime_typeObject (readonly)

Returns the value of attribute mime_type.



12
13
14
# File 'lib/nelumba/binary.rb', line 12

def mime_type
  @mime_type
end

Instance Method Details

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



18
19
20
21
22
23
24
25
26
27
# File 'lib/nelumba/binary.rb', line 18

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

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

#to_hashObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/nelumba/binary.rb', line 29

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

#to_json_hashObject



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/nelumba/binary.rb', line 40

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