Class: RemoveBg::RequestOptions

Inherits:
BaseRequestOptions show all
Defined in:
lib/remove_bg/request_options.rb

Overview

Options for image processing requests. Arbitary options are passed directly to the API.

Constant Summary collapse

SIZE_REGULAR =
"regular"
SIZE_MEDIUM =
"medium"
SIZE_HD =
"hd"
SIZE_4K =
"4k"
SIZE_AUTO =
"auto"
FOREGROUND_TYPE_AUTO =
"auto"
FOREGROUND_TYPE_PERSON =
"person"
FOREGROUND_TYPE_PRODUCT =
"product"
CHANNELS_RGBA =
"rgba"
CHANNELS_ALPHA =
"alpha"
FORMAT_PNG =
"png"
FORMAT_ZIP =
"zip"
FORMAT_JPG =
"jpg"

Instance Attribute Summary

Attributes inherited from BaseRequestOptions

#api_key, #data

Instance Method Summary collapse

Constructor Details

#initialize(raw_options = {}) ⇒ RequestOptions

Returns a new instance of RequestOptions.



24
25
26
27
28
29
30
31
32
33
# File 'lib/remove_bg/request_options.rb', line 24

def initialize(raw_options = {})
  options = raw_options.dup
  options[:size] ||= SIZE_AUTO

  if options.key?(:format)
    options[:format] = optimize_format(options[:format])
  end

  super(options)
end