Class: Faker::LoremFlickr

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/lorem_flickr.rb

Constant Summary collapse

SUPPORTED_COLORIZATIONS =
%w[red green blue].freeze

Constants inherited from Base

Base::Letters, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.colorized_image(size = '300x300', color = 'red', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


24
25
26
27
28
29
# File 'lib/faker/default/lorem_flickr.rb', line 24

def colorized_image(size = '300x300', color = 'red', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
  raise ArgumentError, "Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}" unless SUPPORTED_COLORIZATIONS.include?(color)

  build_url(size, color, search_terms, match_all)
end

.grayscale_image(size = '300x300', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
16
# File 'lib/faker/default/lorem_flickr.rb', line 12

def grayscale_image(size = '300x300', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?

  build_url(size, 'g', search_terms, match_all)
end

.image(size = '300x300', search_terms = [], match_all = false) ⇒ Object



8
9
10
# File 'lib/faker/default/lorem_flickr.rb', line 8

def image(size = '300x300', search_terms = [], match_all = false)
  build_url(size, nil, search_terms, match_all)
end

.pixelated_image(size = '300x300', search_terms = ['all'], match_all = false) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
# File 'lib/faker/default/lorem_flickr.rb', line 18

def pixelated_image(size = '300x300', search_terms = ['all'], match_all = false)
  raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?

  build_url(size, 'p', search_terms, match_all)
end