Class: Imagga::ImageOrUrlParametizer

Inherits:
Object
  • Object
show all
Includes:
Parametizer
Defined in:
lib/imagga/image_or_url_parametizer.rb

Instance Method Summary collapse

Methods included from Parametizer

#build_boolean_options, #build_comma_separated_string

Instance Method Details

#build_ids(urls_or_images) ⇒ Object



17
18
19
# File 'lib/imagga/image_or_url_parametizer.rb', line 17

def build_ids(urls_or_images)
  { ids: build_comma_separated_string(urls_or_images, :id, 0) }
end

#build_urls(urls_or_images) ⇒ Object



13
14
15
# File 'lib/imagga/image_or_url_parametizer.rb', line 13

def build_urls(urls_or_images)
  { urls: [urls_or_images].flatten.map{ |o| o.url rescue o }.join(',') }
end

#parametrize(urls_or_images) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/imagga/image_or_url_parametizer.rb', line 5

def parametrize(urls_or_images)
  options = build_urls(urls_or_images)
  if (ids = build_ids(urls_or_images))[:ids]
    options.merge!(ids)
  end
  options
end