Class: Faker::LoremFlickr
- Defined in:
- lib/faker/default/lorem_flickr.rb
Constant Summary collapse
- SUPPORTED_COLORIZATIONS =
%w[red green blue].freeze
Constants inherited from Base
Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters
Class Method Summary collapse
-
.colorized_image(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false) ⇒ String
Produces a random colorized image URL from loremflickr.com.
-
.grayscale_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) ⇒ String
Produces a random grayscale image URL from loremflickr.com.
-
.image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false) ⇒ String
Produces a random image URL from loremflickr.com.
-
.pixelated_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) ⇒ String
Produces a random pixelated image URL from loremflickr.com.
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(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false) ⇒ String
Produces a random colorized image URL from loremflickr.com.
109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/faker/default/lorem_flickr.rb', line 109 def colorized_image(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false) warn_for_deprecated_arguments do |keywords| keywords << :size if legacy_size != NOT_GIVEN keywords << :color if legacy_color != NOT_GIVEN keywords << :search_terms if legacy_search_terms != NOT_GIVEN keywords << :match_all if legacy_match_all != NOT_GIVEN end 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(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) ⇒ String
Produces a random grayscale image URL from loremflickr.com.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/faker/default/lorem_flickr.rb', line 52 def grayscale_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) warn_for_deprecated_arguments do |keywords| keywords << :size if legacy_size != NOT_GIVEN keywords << :search_terms if legacy_search_terms != NOT_GIVEN keywords << :match_all if legacy_match_all != NOT_GIVEN end raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any? build_url(size, 'g', search_terms, match_all) end |
.image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false) ⇒ String
Produces a random image URL from loremflickr.com.
26 27 28 29 30 31 32 33 34 |
# File 'lib/faker/default/lorem_flickr.rb', line 26 def image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false) warn_for_deprecated_arguments do |keywords| keywords << :size if legacy_size != NOT_GIVEN keywords << :search_terms if legacy_search_terms != NOT_GIVEN keywords << :match_all if legacy_match_all != NOT_GIVEN end build_url(size, nil, search_terms, match_all) end |
.pixelated_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) ⇒ String
Produces a random pixelated image URL from loremflickr.com.
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/faker/default/lorem_flickr.rb', line 80 def (legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false) warn_for_deprecated_arguments do |keywords| keywords << :size if legacy_size != NOT_GIVEN keywords << :search_terms if legacy_search_terms != NOT_GIVEN keywords << :match_all if legacy_match_all != NOT_GIVEN end raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any? build_url(size, 'p', search_terms, match_all) end |