Class: Fushin::Models::Attachment
- Defined in:
- lib/fushin/models/attachment.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #ha_link ⇒ Object
-
#initialize(url) ⇒ Attachment
constructor
A new instance of Attachment.
- #sha256 ⇒ Object
- #title ⇒ Object
- #to_attachements ⇒ Object
Constructor Details
#initialize(url) ⇒ Attachment
Returns a new instance of Attachment.
7 8 9 |
# File 'lib/fushin/models/attachment.rb', line 7 def initialize(url) @url = url end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/fushin/models/attachment.rb', line 6 def url @url end |
Instance Method Details
#ha_link ⇒ Object
22 23 24 |
# File 'lib/fushin/models/attachment.rb', line 22 def ha_link "https://www.hybrid-analysis.com/sample/#{sha256}/" end |
#sha256 ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fushin/models/attachment.rb', line 11 def sha256 @sha256 ||= [].tap do |out| res = HybridAnalysis.quick_url_scan(url) out << res.dig("sha256") end.first end |
#title ⇒ Object
18 19 20 |
# File 'lib/fushin/models/attachment.rb', line 18 def title "HA: #{sha256}" end |
#to_attachements ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fushin/models/attachment.rb', line 26 def to_attachements [ { fallback: "HA link", title: title, title_link: ha_link, footer: "hybrid-analysis.com", footer_icon: "http://www.google.com/s2/favicons?domain=hybrid-analysis.com" } ] end |