Class: Fiddler::Attachment
- Inherits:
-
Object
- Object
- Fiddler::Attachment
- Includes:
- ActiveAttr::Model
- Defined in:
- lib/fiddler/attachment.rb
Overview
the attachment in itself
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#path ⇒ Object
Returns the value of attribute path.
-
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
Class Method Summary collapse
-
.get(id, ticket_id) ⇒ Object
Public class method to get an attachment.
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
50 51 52 |
# File 'lib/fiddler/attachment.rb', line 50 def content @content end |
#path ⇒ Object
Returns the value of attribute path.
50 51 52 |
# File 'lib/fiddler/attachment.rb', line 50 def path @path end |
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
50 51 52 |
# File 'lib/fiddler/attachment.rb', line 50 def ticket_id @ticket_id end |
Class Method Details
.get(id, ticket_id) ⇒ Object
Public class method to get an attachment
53 54 55 56 57 58 59 |
# File 'lib/fiddler/attachment.rb', line 53 def self.get(id, ticket_id) url = "/ticket/#{ticket_id}/attachments/#{id}" response = Fiddler::ConnectionManager.get(url) = Fiddler::Parsers::AttachmentParser.parse_single(response) .ticket_id = ticket_id end |
Instance Method Details
#content_length ⇒ Object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/fiddler/attachment.rb', line 61 def content_length length = header_value_for_key("Content-Length") if !length.nil? length.to_i elsif @content.nil? -1 else @content.length end end |
#has_text_content ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/fiddler/attachment.rb', line 82 def has_text_content if content_type == "text/plain" or content_type == "text/html" return true else return false end end |