Method: Faker::Webhookdb.image_url

Defined in:
lib/webhookdb/fixtures/faker.rb

.image_url(opts = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/webhookdb/fixtures/faker.rb', line 13

def image_url(opts={})
  opts[:protocol] ||= ["https", "http"].sample
  opts[:host] ||= ["facebook.com", "flickr.com", "mysite.com"].sample
  opts[:path] ||= "fld"
  opts[:filename] ||= Faker::Lorem.word
  opts[:ext] ||= ["png", "jpg", "jpeg"].sample
  return "#{opts[:protocol]}://#{opts[:host]}/#{opts[:path]}/#{opts[:filename]}.#{opts[:ext]}"
end