class Bicho::Attachment
Represents an attachment object for a given bug
Attributes
props[R]
Public Class Methods
new(client, xmlrpc_client, props)
click to toggle source
# File lib/bicho/attachment.rb, line 34 def initialize(client, xmlrpc_client, props) @client = client @xmlrpc_client = xmlrpc_client @props = props end
Public Instance Methods
bug_id()
click to toggle source
@return [Fixnum] attachment bug id
# File lib/bicho/attachment.rb, line 46 def bug_id props['bug_id'].to_i end
content_type()
click to toggle source
@return [String] attachment content type
# File lib/bicho/attachment.rb, line 51 def content_type props['content_type'] end
data()
click to toggle source
@return [StringIO] attachmentdata This will be loaded lazyly every time called
# File lib/bicho/attachment.rb, line 67 def data ret = @xmlrpc_client.call('Bug.attachments', attachment_ids: [id], include_fields: ['data']) @client.handle_faults(ret) StringIO.new(ret['attachments'][id.to_s]['data']) end
id()
click to toggle source
@return [Fixnum] attachment id
# File lib/bicho/attachment.rb, line 41 def id props['id'].to_i end
size()
click to toggle source
@return [Fixnum] attachment size
# File lib/bicho/attachment.rb, line 56 def size props['size'].to_i end
summary()
click to toggle source
@return [String] attachment summary
# File lib/bicho/attachment.rb, line 61 def summary props['summary'] end