Module: WpItem::Existable

Included in:
WpItem
Defined in:
lib/common/models/wp_item/existable.rb

Instance Method Summary collapse

Instance Method Details

#exists?(options = {}, response = nil) ⇒ Boolean

Check the existence of the WpItem If the response is supplied, it's used for the verification Otherwise a new request is done

Parameters:

  • options (Hash) (defaults to: {})

    See exists_from_response?

  • response (Typhoeus::Response) (defaults to: nil)

Returns:

  • (Boolean)

14
15
16
17
18
19
# File 'lib/common/models/wp_item/existable.rb', line 14

def exists?(options = {}, response = nil)
  unless response
    response = Browser.get(url)
  end
  exists_from_response?(response, options)
end