Class: Furaffinity::QueueHook::HookRunner
- Inherits:
-
Object
- Object
- Furaffinity::QueueHook::HookRunner
- Includes:
- SemanticLogger::Loggable
- Defined in:
- lib/furaffinity/queue_hook.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#file_info ⇒ Object
readonly
Returns the value of attribute file_info.
-
#submission_info ⇒ Object
readonly
Returns the value of attribute submission_info.
Instance Method Summary collapse
-
#initialize(client, file_info, file_name) ⇒ HookRunner
constructor
A new instance of HookRunner.
- #link_to(url_or_submission, text) ⇒ Object
- #submission_url(submission_id) ⇒ Object
Constructor Details
#initialize(client, file_info, file_name) ⇒ HookRunner
Returns a new instance of HookRunner.
12 13 14 15 16 |
# File 'lib/furaffinity/queue_hook.rb', line 12 def initialize(client, file_info, file_name) @client = client @file_info = file_info @submission_info = file_info.fetch(file_name) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/furaffinity/queue_hook.rb', line 10 def client @client end |
#file_info ⇒ Object (readonly)
Returns the value of attribute file_info.
10 11 12 |
# File 'lib/furaffinity/queue_hook.rb', line 10 def file_info @file_info end |
#submission_info ⇒ Object (readonly)
Returns the value of attribute submission_info.
10 11 12 |
# File 'lib/furaffinity/queue_hook.rb', line 10 def submission_info @submission_info end |
Instance Method Details
#link_to(url_or_submission, text) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/furaffinity/queue_hook.rb', line 20 def link_to(url_or_submission, text) url = case url_or_submission in { id: } submission_url(id) else if url_or_submission.is_a?(Hash) logger.warn { "passed hash does not have an ID, probably not uploaded yet? hash keys: #{url_or_submission.keys.inspect}" } end url_or_submission.to_s end "[url=#{url}]#{text}[/url]" end |
#submission_url(submission_id) ⇒ Object
18 |
# File 'lib/furaffinity/queue_hook.rb', line 18 def submission_url(submission_id) = "https://www.furaffinity.net/view/#{submission_id}/" |