Class: Flickrage::Service::Search

Inherits:
Object
  • Object
show all
Includes:
Helpers::Log
Defined in:
lib/flickrage/service/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Log

#logger, #speaker

Constructor Details

#initializeSearch

Returns a new instance of Search.



9
10
11
# File 'lib/flickrage/service/search.rb', line 9

def initialize
  @tagged_search = Flickrage.config.tagged_search
end

Instance Attribute Details

#tagged_searchObject (readonly)

Returns the value of attribute tagged_search.



7
8
9
# File 'lib/flickrage/service/search.rb', line 7

def tagged_search
  @tagged_search
end

Instance Method Details

#run(keyword) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/flickrage/service/search.rb', line 13

def run(keyword)
  result = search(keyword)

  return if result.size < 1

  image(result.first, keyword)
rescue StandardError => e
  logger.debug(e)
  nil
end