Class: Furaffinity::QueueHook::HookRunner

Inherits:
Object
  • Object
show all
Includes:
SemanticLogger::Loggable
Defined in:
lib/furaffinity/queue_hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



10
11
12
# File 'lib/furaffinity/queue_hook.rb', line 10

def client
  @client
end

#file_infoObject (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_infoObject (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



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}/"